DocTaur - intranet directory of reference manuals
Yo-store
books for webmasters

reference manuals search engine

MySQL Reference Manual - 4.0.20

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.8.6.1 Constraint PRIMARY KEY / UNIQUE

Normally you will get an error when you try to INSERT or UPDATE a row that causes a primary key, unique key, or foreign key violation. If you are using a transactional storage engine such as InnoDB, MySQL will automatically roll back the transaction. If you are using a non-transactional storage engine, MySQL will stop at the incorrect row and leave any remaining rows unprocessed.

To make life easier, MySQL supports an IGNORE keyword for most commands that can cause a key violation (such as INSERT IGNORE and UPDATE IGNORE). In this case, MySQL will ignore any key violation and continue with processing the next row. You can get information about what MySQL did with the mysql_info() API function. See section mysql_info(). In MySQL 4.1 and up, you also can use the SHOW WARNINGS statement. See section SHOW WARNINGS Syntax.

Note that, for the moment, only InnoDB tables support foreign keys. See section FOREIGN KEY Constraints. Foreign key support in MyISAM tables is scheduled for implementation in MySQL 5.1.


This document was generated on July, 26 2004 using texi2html 1.70.