Cannot resolve table name close to

前端 未结 3 1847
别那么骄傲
别那么骄傲 2020-12-17 10:24

I want to create a references to foreign table. but i\'m getting the following error:

query:

CREATE TABLE category_ids (id INT, post_id INT,
                 


        
相关标签:
3条回答
  • 2020-12-17 11:09

    This error can also come when parent table is partitioned. Removing partitioning from the parent table allows foreign constraint to be created without any problem.

    0 讨论(0)
  • 2020-12-17 11:13

    Only InnoDB supports Foreign keys, MyISAM doesn't. Even if it would, you cannot create relations between tables of different type.

    Therefore you need to convert the table post into InnoDB. ALTER TABLE post ENGINE = InnoDB;

    0 讨论(0)
  • 2020-12-17 11:14

    For me works with this.

    CREATE TABLE category_ids (id INT, post_id INT references post(id),
                    INDEX par_ind (post_id)
    ) ENGINE=INNODB;
    
    0 讨论(0)
提交回复
热议问题