Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Very Strange INNODB Problem (Please Read - May Affect YOU!!)

Status
Not open for further replies.

jjjamie

Programmer
Sep 11, 2002
10
GB
Please cast your eyes over this....

Code:
mysql> CREATE TABLE labour(
    ->    labour_id        INT AUTO_INCREMENT,
    ->    workdate         DATE,
    ->    realstart        TIME,
    ->    starttime        TIME,
    ->    stoptime         TIME,
    ->    CONSTRAINT PRIMARY KEY (labour_id)
    -> );
Query OK, 0 rows affected (0.06 sec)

mysql> insert labour values (1, "2002-10-02", "00:00:00", "00:00:00", "00:00:00");
Query OK, 1 row affected (0.05 sec)

mysql> insert labour values (2, "2002-10-02", "00:00:00", "00:00:00", "00:00:00");
Query OK, 1 row affected (0.04 sec)

mysql> insert labour values (3, "2002-10-02", "00:00:00", "00:00:00", "00:00:00");
Query OK, 1 row affected (0.05 sec)

mysql> select * from labour;
+-----------+------------+-----------+-----------+----------+
| labour_id | workdate   | realstart | starttime | stoptime |
+-----------+------------+-----------+-----------+----------+
|         1 | 2002-10-02 | 00:00:00  | 00:00:00  | 00:00:00 |
|         2 | 2002-10-02 | 00:00:00  | 00:00:00  | 00:00:00 |
|         3 | 2002-10-02 | 00:00:00  | 00:00:00  | 00:00:00 |
+-----------+------------+-----------+-----------+----------+
3 rows in set (0.00 sec)

mysql> delete from labour where labour_id = 3;
Query OK, 1 row affected (0.14 sec)

mysql> delete from labour where labour_id = 2;
Query OK, 1 row affected (0.13 sec)

mysql> delete from labour where labour_id = 5;
Query OK, 0 rows affected (0.00 sec)

mysql> delete from labour where labour_id = 1;
ERROR 1217: Cannot delete a parent row: a foreign key constraint fails
mysql>

There are no constraints referencing this table and the default table type is set to INNODB.

I am gratefull for any assistance anyone can provide.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top