Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id DF3C716FA502 for ; Mon, 9 Jul 2012 14:19:56 -0300 (ADT) Received: from mahout.postgresql.org ([98.129.198.123]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SoHco-0001gF-T5 for pgsql-bugs@postgresql.org; Mon, 09 Jul 2012 17:19:56 +0000 Received: from [204.145.124.246] (helo=wrigleys.postgresql.org) by mahout.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SoHcb-0001fD-Ea for pgsql-bugs@postgresql.org; Mon, 09 Jul 2012 17:19:41 +0000 Received: from www-data by wrigleys.postgresql.org with local (Exim 4.72) (envelope-from ) id 1SoHca-0005qD-Qx for pgsql-bugs@postgresql.org; Mon, 09 Jul 2012 17:19:40 +0000 Date: Mon, 09 Jul 2012 17:19:40 +0000 Message-Id: Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #6724: EXCEPTION syntax not recgonised To: pgsql-bugs@postgresql.org From: chine.bleu@yahoo.com X-Pg-Spam-Score: 0.6 (/) X-Archive-Number: 201207/68 X-Sequence-Number: 33544 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: = 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.