On duplicate ignore - Mailing list pgsql-general

From Gnanakumar
Subject On duplicate ignore
Date
Msg-id 019901ccd5d0$f4a1cca0$dde565e0$@com
Whole thread Raw
Responses Re: On duplicate ignore
List pgsql-general
Hi,

Ours is a web-based application.  We're trying to implement ON DUPLICATE
IGNORE for one of our application table, named EMAILLIST.  After a quick
Google search, I'm finding the following "easy & convenient" single SQL
statement syntax to follow with:

INSERT INTO EMAILLIST (EMAIL)
       SELECT 'john@example.net'
       WHERE NOT EXISTS (SELECT 1 FROM EMAILLIST WHERE EMAIL =
'john@example.net');

My question is, in a single threaded INSERT, this will *definitely* work.
Since ours is a web-based application, will this work out in a concurrent
multi-threaded environment too?  In other words, will it be truly unique
when INSERT calls are concurrent?

Regards,
Gnanam



pgsql-general by date:

Previous
From: Jasen Betts
Date:
Subject: Re: Appending a newline to a column value - in a psql cronjob
Next
From: Atul Goel
Date:
Subject: Re: On duplicate ignore