Retrieve insert_id on an insert ignore?

2008-08-19 Thread Brian Dunning
I have a table like this: unique_serial - Auto Increment field_1 field_2 field_3 The Primary key is a combination of field_1, field_2, and field_3. I want to do: INSERT IGNORE INTO table_name (field_1,field_2,field_3) VALUES ('xx','xx','xx') Sometimes this will be an existing record

Re: INSERT IGNORE BUG?

2007-02-08 Thread Eric Bergen
Hi Ed, Can you please reply with a repeatable test case? On 2/1/07, Ed Pauley II [EMAIL PROTECTED] wrote: I am importing a file into a table in which I want it to ignore duplicate rows. When I specify --ignore (this also happens if I do a SELECT IGNORE INTO from the client also) I get a

INSERT IGNORE BUG?

2007-02-01 Thread Ed Pauley II
I am importing a file into a table in which I want it to ignore duplicate rows. When I specify --ignore (this also happens if I do a SELECT IGNORE INTO from the client also) I get a duplicate key error. If I run the command again it skips the first such instance of a duplicate key and gives me

mysqldump: getting it to dump INSERT IGNORE

2005-12-11 Thread Michael Williams
Hi All, I have read thehttp://dev.mysql.com/doc/refman/5.0/en/ mysqldump.html and can find nothing regarding getting dump to INSERT IGNORE instead of simply INSERT INTO. Is there any way to get INSERT IGNORE to be dumped? Otherwise, I fear I may be forced to parse the dump file

Re: mysqldump: getting it to dump INSERT IGNORE

2005-12-11 Thread Richard AB
Hi. Use the --insert-ignore option of mysqldump. You can type 'mysqldump --help' on command line to see all options available. Richard AB. - Original Message - From: Michael Williams [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Sunday, December 11, 2005 6:19 PM Subject

Questions on INSERT IGNORE

2005-11-01 Thread Hal Vaughan
I want to be sure I understand INSERT IGNORE... correctly before I start depending on it. Up until now, I have not been using any kind of key or unique index, since many of my tables are created automatically and, until now, it has been difficult for me to create a way to distinguish between

Re: Questions on INSERT IGNORE

2005-11-01 Thread SGreen
Comments embedded. See below Hal Vaughan [EMAIL PROTECTED] wrote on 11/01/2005 02:50:13 PM: I want to be sure I understand INSERT IGNORE... correctly before I start depending on it. Up until now, I have not been using any kind of key or unique index, since many of my tables are created

Re: Questions on INSERT IGNORE

2005-11-01 Thread Hal Vaughan
INSERT IGNORE..., MySQL will still have to verify that the new record does not match any old records. How much faster is it to do it that way than the way I was? I'd think the same routines to find matching data would be used. No, the same routine will not be used. A hash

Re: Questions on INSERT IGNORE

2005-11-01 Thread Hal Vaughan
threw out the record I was going to enter, if there was not a match, I'd INSERT the new record.  If I use INSERT IGNORE..., MySQL will still have to verify that the new record does not match any old records.  How much faster is it  to do it that way than the way I

Re: INSERT IGNORE Doesn't Seem To Work

2005-08-25 Thread Alec . Cawley
Hal Vaughan [EMAIL PROTECTED] wrote on 24/08/2005 17:41:36: # Okay, so INSERT IGNORE only works if I am avoiding duplicate keys. Is there any way to use INSERT the way I thought INSERT IGNORE worked -- in other words is there any keyword for the INSERT command to keep it from

Re: INSERT IGNORE Doesn't Seem To Work

2005-08-25 Thread Hal Vaughan
On Thursday 25 August 2005 04:44 am, [EMAIL PROTECTED] wrote: Hal Vaughan [EMAIL PROTECTED] wrote on 24/08/2005 17:41:36: # Okay, so INSERT IGNORE only works if I am avoiding duplicate keys. Is there any way to use INSERT the way I thought INSERT IGNORE worked -- in other words

Re: INSERT IGNORE Doesn't Seem To Work

2005-08-25 Thread Peter Brawley
Hal, *IF* INSERT IGNORE worked ... INSERT IGNORE _does_ work exactly as documented in the manual: "If you specify the IGNORE keyword in an INSERT statement, errors that occur while executing the statement are treated as warnings instead. For example, without IGNORE, a row that dupli

INSERT IGNORE Doesn't Seem To Work

2005-08-24 Thread Hal Vaughan
I may have a misunderstanding of this, but as I have been told, if I have a table with 3 columns, Idx (an Index column, unique, auto-increment), Name, Value (both varchar), and I try a command like this: INSERT IGNORE INTO myTable SET Name = Variable1, Value = 100; or INSERT IGNORE INTO myTable

Re: INSERT IGNORE Doesn't Seem To Work

2005-08-24 Thread Johan Höök
Hi Hal, in order to get INSERT IGNORE to work as you want it you must violate a unique index somehow, i.e. you must have a unique index on Name,Value or both and then you would get a quiet ignore of that violation. The IGNORE keyword doesn't make the INSERT as such different, it just affects

Re: INSERT IGNORE Doesn't Seem To Work

2005-08-24 Thread Alec . Cawley
INSERT IGNORE Doesn't Seem To Work I may have a misunderstanding of this, but as I have been told, if I have a table with 3 columns, Idx (an Index column, unique, auto-increment), Name, Value (both varchar), and I try a command like this: INSERT IGNORE INTO myTable SET Name = Variable1

Re: INSERT IGNORE Doesn't Seem To Work

2005-08-24 Thread Hal Vaughan
On Wednesday 24 August 2005 02:47 am, Hal Vaughan wrote: I may have a misunderstanding of this, but as I have been told, if I have a table with 3 columns, Idx (an Index column, unique, auto-increment), Name, Value (both varchar), and I try a command like this: INSERT IGNORE INTO myTable SET

Re: INSERT IGNORE Doesn't Seem To Work

2005-08-24 Thread SGreen
varchar), and I try a command like this: INSERT IGNORE INTO myTable SET Name = Variable1, Value = 100; or INSERT IGNORE INTO myTable (Name, Value) VALUES(Variable1, 100); AND I already have a row with the matching Name and Value columns matching in value, that MySQL will detect

RE: INSERT IGNORE like feature for rows failing foreign key constraints?

2004-08-31 Thread John McCaskey
I never got a reply for this, and I'm still trying to figure out the best way to handle it. Anyone? John A. McCaskey -Original Message- From: John McCaskey [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 25, 2004 2:17 PM To: [EMAIL PROTECTED] Subject: INSERT IGNORE like feature

INSERT IGNORE like feature for rows failing foreign key constraints?

2004-08-25 Thread John McCaskey
want the behavior to be that the one fails silently and the other 4999 insert successfully. Any ideas how I can do this? It seems like INSERT IGNORE would make sense but that appears to only ignore duplicates not foreign key failures. John A. McCaskey Software Development Engineer IP

INSERT IGNORE

2002-09-17 Thread Alec . Cawley
According to the manual, if INSERT IGNORE finds a row already present in the table, it does not update the row with the new data. How can I get the opposite behaviour? In my case, there shouldn't be a record with the unique ID I am inserting. But if there is, my recovery behaviour is to delete

Re: INSERT IGNORE

2002-09-17 Thread Joseph Bueno
Hi, Look at REPLACE statement. Regards -- Joseph Bueno [EMAIL PROTECTED] wrote: According to the manual, if INSERT IGNORE finds a row already present in the table, it does not update the row with the new data. How can I get the opposite behaviour? In my case, there shouldn't be a record

Re: INSERT IGNORE

2002-09-17 Thread Mark Goodge
At 10:24 17/09/2002 +0100, [EMAIL PROTECTED] wrote: According to the manual, if INSERT IGNORE finds a row already present in the table, it does not update the row with the new data. How can I get the opposite behaviour? In my case, there shouldn't be a record with the unique ID I am inserting

Re: last_insert_id() bug ?? using INSERT IGNORE

2001-10-01 Thread Benjamin Pflugmann
Hi. On Mon, Oct 01, 2001 at 12:30:10AM -0400, [EMAIL PROTECTED] wrote: Paul DuBois INSERT IGNORE can't fully assess whether the record is to be ignored Paul DuBois until the record's contents have been generated. And why can't it wait until after the ignore/don't ignore assessment before

Re: last_insert_id() bug ?? using INSERT IGNORE

2001-10-01 Thread marcus davy
to increment by one in situations when the query is not adding any new information to the table. This looks like a bug to me can anyone enlighten me to this anomaly? Why is it a bug? INSERT IGNORE can't fully assess whether the record is to be ignored until the record's contents have been

Re: last_insert_id() bug ?? using INSERT IGNORE

2001-10-01 Thread Paul DuBois
. But the last_insert_id() function still appears to increment by one in situations when the query is not adding any new information to the table. This looks like a bug to me can anyone enlighten me to this anomaly? Why is it a bug? INSERT IGNORE can't fully assess whether

Re: last_insert_id() bug ?? using INSERT IGNORE

2001-10-01 Thread marcus davy
is it a bug? INSERT IGNORE can't fully assess whether the record is to be ignored until the record's contents have been generated. I am using 3.23.42-log on red hat 7.1 (also same results on 3.23.40-log). I have searched the list archive for this topic but havent found anything yet

last_insert_id() bug ?? using INSERT IGNORE

2001-09-30 Thread marcus davy
; CREATE TABLE organism ( OM varchar(100) NOT NULL unique, OM_ID tinyint(1) NOT NULL auto_increment, PRIMARY KEY (OM_ID) ) TYPE=MyISAM; INSERT IGNORE INTO organism VALUES('foo', NULL); INSERT IGNORE INTO organism VALUES('fodda', NULL); SELECT * FROM organism; #+---+---+ #| OM| OM_ID

Re: last_insert_id() bug ?? using INSERT IGNORE

2001-09-30 Thread Paul DuBois
is not adding any new information to the table. This looks like a bug to me can anyone enlighten me to this anomaly? Why is it a bug? INSERT IGNORE can't fully assess whether the record is to be ignored until the record's contents have been generated. I am using 3.23.42-log on red hat 7.1 (also

RE: last_insert_id() bug ?? using INSERT IGNORE

2001-09-30 Thread Will French
Paul DuBois INSERT IGNORE can't fully assess whether the record is to be ignored Paul DuBois until the record's contents have been generated. And why can't it wait until after the ignore/don't ignore assessment before assigning a new id? Call it a bug... call it a design feature... call it what