Re: [SQL] duplicate key violates unique constraint

2008-02-26 Thread Edward W. Rouse
; Shavonne Marietta Wijesinghe Subject: Re: [SQL] duplicate key violates unique constraint Shavonne, You will probably always find someone on the list who will answer your questions, but you really should read the manual too! In this case you could have found the answer by reading http

Re: [SQL] duplicate key violates unique constraint

2008-02-26 Thread Rodrigo E. De León Plicet
On Tue, Feb 26, 2008 at 11:36 AM, Shavonne Marietta Wijesinghe <[EMAIL PROTECTED]> wrote: > BEGIN > SAVEPOINT s1; > ... code here ... > EXCEPTION > WHEN ... THEN > ROLLBACK TO s1; > ... code here ... > WHEN ... THEN > ROLLB

Re: [SQL] duplicate key violates unique constraint

2008-02-26 Thread Alvaro Herrera
Shavonne Marietta Wijesinghe wrote: > I wrote the query in the SQL windows provided by the pgadmin. That SQL window only executes SQL, so you can't use PL/pgSQL commands on it. PL/pgSQL can only be used in the context of a PL/pgSQL function, so you need to do CREATE FUNCTION to do that. If you w

Re: [SQL] duplicate key violates unique constraint

2008-02-26 Thread Shavonne Marietta Wijesinghe
2008 5:28 PM Subject: Re: [SQL] duplicate key violates unique constraint On Tuesday 26 February 2008, Andrew Sullivan wrote: Well, except that there's no "EXCEPTION" statement in SQL? Â I think your correspondent was intending for this to be programmatic. I was thinking pl/pgs

Re: [SQL] duplicate key violates unique constraint

2008-02-26 Thread Bart Degryse
olation THEN INSERT INTO my_shevi values ('a', 5, 2, 2); END; I don't see anything wrong with the code.. Shavonne - Original Message - From: "Teemu Torma" <[EMAIL PROTECTED]> To: Sent: Tuesday, February 26, 2008 4:17 PM Subject: Re: [SQL] duplicate key vio

Re: [SQL] duplicate key violates unique constraint

2008-02-26 Thread Teemu Torma
On Tuesday 26 February 2008, Andrew Sullivan wrote: > Well, except that there's no "EXCEPTION" statement in SQL?  I think > your correspondent was intending for this to be programmatic. I was thinking pl/pgsql. Teemu ---(end of broadcast)--- TIP

Re: [SQL] duplicate key violates unique constraint

2008-02-26 Thread Andrew Sullivan
On Tue, Feb 26, 2008 at 05:05:01PM +0100, Shavonne Marietta Wijesinghe wrote: > Thank you. I tried as you said. But i get a ERROR: syntax error at or near > "INSERT" at character 9 > I don't see anything wrong with the code.. Well, except that there's no "EXCEPTION" statement in SQL? I think

Re: [SQL] duplicate key violates unique constraint

2008-02-26 Thread Shavonne Marietta Wijesinghe
ing wrong with the code.. Shavonne - Original Message - From: "Teemu Torma" <[EMAIL PROTECTED]> To: Sent: Tuesday, February 26, 2008 4:17 PM Subject: Re: [SQL] duplicate key violates unique constraint On Tuesday 26 February 2008, Shavonne Marietta Wijesinghe wrote: Duri

Re: [SQL] duplicate key violates unique constraint

2008-02-26 Thread Teemu Torma
On Tuesday 26 February 2008, Shavonne Marietta Wijesinghe wrote: > During an "INSERT INTO" I get an "Error - duplicate key violates > unique constraint" > > Is there any way, that i can test the error. Something like this?? > > IF error = "duplicate key violates unique constraint" then >     do

[SQL] duplicate key violates unique constraint

2008-02-26 Thread Shavonne Marietta Wijesinghe
Hello During an "INSERT INTO" I get an "Error - duplicate key violates unique constraint" Is there any way, that i can test the error. Something like this?? IF error = "duplicate key violates unique constraint" then do something else insert into end if Thanks Shavonne