Re: [SQL] handling duplicate row exception

2011-09-26 Thread Filip Rembiałkowski
W dniu 22 września 2011 08:11 użytkownik Amar Dhole napisał: > ** > > Hi Filip, > > ** ** > > No not sure 100% when this can happen. This approach will not be possible > as in our application we are programmatically handling these cases and going > in other route to add the record with increas

Re: [SQL] handling duplicate row exception

2011-09-21 Thread Amar Dhole
: pgsql-sql-ow...@postgresql.org [mailto:pgsql-sql-ow...@postgresql.org] On Behalf Of Filip Rembialkowski Sent: 21 September 2011 20:37 To: Amar Dhole Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] handling duplicate row exception Hi There is no IGNORE_DUP_KEY equivalent in PostgreSQL. If you are

Re: [SQL] handling duplicate row exception

2011-09-21 Thread Filip Rembiałkowski
Hi There is no IGNORE_DUP_KEY equivalent in PostgreSQL. If you are 100% sure that you want to ignore unique key violations, you can wrap your INSERT code in PL/PgSQL block and handle the exception yourself. I mean: DO $$ BEGIN INSERT INTO foo (bar,baz) SELECT 42, 666; EXCEPTION WHEN unique_vio