INSERT IGNORE in MySQL 4.1 - purpose?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
fgomez
Forum Commoner
Posts: 61
Joined: Mon Sep 26, 2005 11:23 pm
Location: Washington, DC

INSERT IGNORE in MySQL 4.1 - purpose?

Post by fgomez »

After staring at the screen for what feels like hours, I think I've realized the purpose of INSERT IGNORE, which appears to be precisely the opposite of what I thought. Could someone confirm this?

I *thought* INSERT IGNORE would ignore the fact that my table already contains a record with unique key and INSERT the new record right over top of it. It appears that what it REALLY does is ignore the new row, insert nothing, and not give me the duplicate key error I would get if I didn't use IGNORE.

Am I right? :oops:
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

That's exactly what INSERT IGNORE does, last I saw. In fact, the insert syntax page(s) back that up.

http://dev.mysql.com/doc/refman/5.1/en/insert.html
Post Reply