|
Posted by Andy Hassall on 07/25/06 16:50
On 25 Jul 2006 08:19:30 -0700, laredotornado@zipmail.com wrote:
>Hi, Using PHP 4, MySQL 4, I'm getting an error when executing an SQL
>statement:
>
>Statement failed "DELETE FROM USERS WHERE USER_ID = 17" - Cannot delete
>or update a parent row: a foreign key constraint fails
>
>How can I query the SQL database to figure out what parent row the
>statement is complaining about?
It seems the only way to list foreign keys in MySQL is using SHOW CREATE
TABLE, which doesn't help you much.
SHOW INNODB STATUS shows information on recent foreign key errors, but that'll
all be mixed together with other sessions.
--
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
[Back to original message]
|