Error Creating Foreign Key On User Id Check Data Types
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might error creating foreign key check data types phpmyadmin have Meta Discuss the workings and policies of this site About error creating foreign key on name (check data types) Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting
#1452 - Cannot Add Or Update A Child Row: A Foreign Key Constraint Fails
ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up MySQL Error creating foreign key on
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Error creating foreign key up vote 0 down vote favorite I have been searching both SO and Google for this issue, http://stackoverflow.com/questions/21711232/mysql-error-creating-foreign-key-on-columname-check-data-types but what i came up with was pretty much what my error message tells me and that's not the problem. I am using PHPMyAdmin to create relations between tables. I have this table "warehouse_product_history" with a column "from" of type int(11) NULL. I try to create a foreign key to the table "warehouses", and the query that PHPMyAdmin executes when doing so is the following ALTER TABLE `warehouse_product_history` ADD FOREIGN KEY (`from`) REFERENCES `my_db`.`warehouses` http://stackoverflow.com/questions/14801458/error-creating-foreign-key (`id`) ON DELETE CASCADE ON UPDATE CASCADE; The type of warehouses->id is int(11) NOT NULL, so that shouldn't be the problem. I've tried to change the datatype of the `from-column to int(11) NOT NULL but with the same result. I get this error message Error creating foreign key on from (check data types) mysql share|improve this question edited Feb 10 '13 at 19:41 asked Feb 10 '13 at 19:05 Anton Gildebrand 1,37063161 What specific error are you receiving? Are you receiving this on an existing populated table? Are both tables InnoDB? Have you run SHOW INNODB STATUS after trying to create the constraint? Are both columns identical? –Kermit Feb 10 '13 at 19:08 Updated the question with the error. The warehouse table is populated. warehouse_product_history isn't. I don't have permissions to show innodb status unfortunately. They are indeed identical. –Anton Gildebrand Feb 10 '13 at 19:50 Can you share the table schema for both, so that we can try? –SparKot Feb 10 '13 at 20:34 The tables can be found on this link pastebin.com/pTxg8Bzm –Anton Gildebrand Feb 10 '13 at 20:42 add a comment| 1 Answer 1 active oldest votes up vote 4 down vote accepted From your table schema, your columns are not identical. warehouses.id is UNSIGNED NOT NULL where warehou
log in tour help Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn http://dba.stackexchange.com/questions/142646/error-creating-foreign-key-on-check-data-types more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Database Administrators Questions Tags Users Badges Unanswered Ask Question _ Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute: Sign up Here's how it works: Anybody foreign key can ask a question Anybody can answer The best answers are voted up and rise to the top Error creating foreign key on (check data types) up vote -1 down vote favorite Very weird problem. I need help, I can't figure out and I don't know how to trace the specific errors in phpmyadmin. I have 2 tables and I want to create FK between them. The first table error creating foreign is keywords: The second table is rankings: When I create FK on domain_id and keyword that working perfect,when I try to create on user_owe_id its says: Error creating foreign key on user_owe_id (check data types) Both columns are the same type and same name I don't know why its not working any hints please?. mysql sql phpmyadmin share|improve this question edited Jun 30 at 9:15 Joe Taras 434311 asked Jun 30 at 8:30 Ravivgg 1 1 Why do you need 2 FKs between the tables? What are their relationships? And what is the primary key of keywords? –ypercubeᵀᴹ Jun 30 at 8:45 1 Please post the SQL statement about creation of FK on user_owe_id –Joe Taras Jun 30 at 8:50 add a comment| active oldest votes Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook. Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Email discard By posting your answer, you agree to the privacy policy and terms of service. Browse other questions tagged mysql sql phpmyadm