BUG #6724: EXCEPTION syntax not recgonised - Mailing list pgsql-bugs

From chine.bleu@yahoo.com
Subject BUG #6724: EXCEPTION syntax not recgonised
Date
Msg-id E1SoHca-0005qD-Qx@wrigleys.postgresql.org
Whole thread Raw
Responses Re: BUG #6724: EXCEPTION syntax not recgonised
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      6724
Logged by:          Chine Bleu
Email address:      chine.bleu@yahoo.com
PostgreSQL version: 9.0.4
Operating system:   macosx
Description:=20=20=20=20=20=20=20=20

query: BEGIN
INSERT INTO config (name, value) VALUES (E'dbexp', E'10');
EXCEPTION WHEN unique_violation THEN
UPDATE config SET value=3DE'10' WHERE name=3DE'dbexp';
END error: fatal query: ERROR:  syntax error at or near "INSERT"
LINE 2: INSERT INTO config (name, value) VALUES (E'dbexp', E'10');
        ^


query: BEGIN;
INSERT INTO config (name, value) VALUES (E'dbexp', E'10');
EXCEPTION WHEN unique_violation THEN
UPDATE config SET value=3DE'10' WHERE name=3DE'dbexp';
END error: fatal query: ERROR:  syntax error at or near "EXCEPTION"
LINE 3: EXCEPTION WHEN unique_violation THEN
        ^

This is so much easier than implementing that horror of REPLACE everyone
else has somehow figured out how to implement.

And, no, I don't really expect an answer. I will continue to use the
DELETE...;;INSERT... improvement on REPLACE.

pgsql-bugs by date:

Previous
From: heiko.helmbrecht@xclinical.com
Date:
Subject: BUG #6723: Exception for correct query
Next
From: Pavel Stehule
Date:
Subject: Re: BUG #6724: EXCEPTION syntax not recgonised