Inserting records in Mysql with INSERT IGNORE and NULL values

Posted by Homer1980ar on Stack Overflow See other posts from Stack Overflow or by Homer1980ar
Published on 2010-06-10T16:36:26Z Indexed on 2010/06/10 16:52 UTC
Read the original article Hit count: 260

Filed under:
|
|

I have a partitioned table InnoDB with several fields. I'm trying to avoid duplicates on insert.

Let's say:

Field1 int null Field2 int null Field3 int null Field4 int null Field5 int null

I have created a UNIQUE index on those fields. I try to insert some records with NULL values and then try to reinsert them with IGNORE feature on MySql.

Unfortunately it seems to replicated the records when using NULL values. If I try with zeros instead of NULL cases everything works, but I do need the nulls there.

Any idea?

Thanks, Leonardo

© Stack Overflow or respective owner

Related posts about mysql

Related posts about insert