Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VMJVk-0000Lo-2E for pgsql-admin@arkaria.postgresql.org; Wed, 18 Sep 2013 15:17:48 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VMJVj-0001to-9u for pgsql-admin@arkaria.postgresql.org; Wed, 18 Sep 2013 15:17:47 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VMJVi-0001ti-Ay for pgsql-admin@postgresql.org; Wed, 18 Sep 2013 15:17:46 +0000 Received: from mail.trovaprezzi.it ([2.228.21.217]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VMJVf-0005EQ-B9 for pgsql-admin@postgresql.org; Wed, 18 Sep 2013 15:17:45 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.trovaprezzi.it (Postfix) with ESMTP id 8A767821C0; Wed, 18 Sep 2013 17:12:02 +0200 (CEST) X-Virus-Scanned: amavisd-new at zimbra.7pixel.local Received: from mail.trovaprezzi.it ([127.0.0.1]) by localhost (zimbra.7pixel.local [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3eHrAxlmzhvl; Wed, 18 Sep 2013 17:12:02 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail.trovaprezzi.it (Postfix) with ESMTP id 308DA821C1; Wed, 18 Sep 2013 17:12:02 +0200 (CEST) X-Virus-Scanned: amavisd-new at zimbra.7pixel.local Received: from mail.trovaprezzi.it ([127.0.0.1]) by localhost (zimbra.7pixel.local [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id l6LKmx2nkpGl; Wed, 18 Sep 2013 17:12:01 +0200 (CEST) Received: from zimbra.7pixel.local (zimbra.7pixel.local [192.168.0.127]) by mail.trovaprezzi.it (Postfix) with ESMTP id 87FD2821C0; Wed, 18 Sep 2013 17:12:01 +0200 (CEST) Date: Wed, 18 Sep 2013 17:12:01 +0200 (CEST) From: Roberto Grandi To: Igor Neyman Cc: pgsql-admin@postgresql.org Message-ID: <1419174490.399836.1379517121348.JavaMail.root@trovaprezzi.it> In-Reply-To: References: <1725603904.387654.1379499282544.JavaMail.root@trovaprezzi.it> <452256586.387717.1379499437400.JavaMail.root@trovaprezzi.it> Subject: Re: Catch exceptions outside function MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [91.204.80.113] X-Mailer: Zimbra 8.0.2_GA_5569 (ZimbraWebClient - FF23 (Win)/8.0.2_GA_5569) Thread-Topic: Catch exceptions outside function Thread-Index: Ac60dC2qGlBQ9HUpTUGglTj2oqtL9HG/mTQl X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org Thanks Igor, this is a sufficient idea to take into account for upgrading to 9.x release. Thanks again. Roberto ----- Messaggio originale ----- Da: "Igor Neyman" A: "Roberto Grandi" , pgsql-admin@postgresql= .org Inviato: Mercoled=C3=AC, 18 settembre 2013 15:37:12 Oggetto: RE: Catch exceptions outside function > -----Original Message----- > From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin- > owner@postgresql.org] On Behalf Of Roberto Grandi > Sent: Wednesday, September 18, 2013 6:17 AM > To: pgsql-admin@postgresql.org > Subject: [ADMIN] Catch exceptions outside function >=20 >=20 > Dear all >=20 > I ask for your help cause I can't point out the solution to my problem on= PG > 8.3 I would catch an exception outside any function/procedure but directly > within script. >=20 >=20 > BEGIN; >=20 > -- raise an exception code >=20 > EXCEPTION > WHEN 'exception_type' > THEN ROLLBACK; >=20 > COMMIT; >=20 > is it possible with PG 8.3? >=20 >=20 > Many thanks in advance. >=20 > Roberto >=20 No. It's not possible in 8.3. What you want is basically anonymous plpgsql block, "EXCEPTION" - is plpgsq= l, not pure sql, could be used only inside plpgsql function in 8.3. OTOH, starting with 9.0 you can use anonymous plpgsql blocks, and get what = you asked for. Regards, Igor Neyman --=20 Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin