pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Roberto Grandi <roberto.grandi@trovaprezzi.it>
To: Igor Neyman <ineyman@perceptron.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: Catch exceptions outside function
Date: Wed, 18 Sep 2013 17:12:01 +0200 (CEST)
Message-ID: <1419174490.399836.1379517121348.JavaMail.root@trovaprezzi.it> (raw)
In-Reply-To: <A76B25F2823E954C9E45E32FA49D70EC4281FF26@mail.corp.perceptron.com>
References: <1725603904.387654.1379499282544.JavaMail.root@trovaprezzi.it>
	<452256586.387717.1379499437400.JavaMail.root@trovaprezzi.it>
	<A76B25F2823E954C9E45E32FA49D70EC4281FF26@mail.corp.perceptron.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-admin>

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" <ineyman@perceptron.com>
A: "Roberto Grandi" <roberto.grandi@trovaprezzi.it>, pgsql-admin@postgresql.org
Inviato: Mercoledì, 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
> 
> 
> Dear all
> 
> 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.
> 
> 
> BEGIN;
> 
> -- raise an exception code
> 
> EXCEPTION
> WHEN 'exception_type'
> THEN ROLLBACK;
> 
> COMMIT;
> 
> is it possible with PG 8.3?
> 
> 
> Many thanks in advance.
> 
> Roberto
> 

No. It's not possible in 8.3.
What you want is basically anonymous plpgsql block, "EXCEPTION" - is plpgsql, 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





-- 
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



view thread (10+ messages)  latest in thread

Message-ID: <1419174490.399836.1379517121348.JavaMail.root@trovaprezzi.it>
Permalink:  ../1419174490.399836.1379517121348.JavaMail.root@trovaprezzi.it/
Also on:    postgresql.org/message-id/1419174490.399836.1379517121348.JavaMail.root@trovaprezzi.it

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: roberto.grandi@trovaprezzi.it, ineyman@perceptron.com
  Subject: Re: Catch exceptions outside function
  In-Reply-To: <1419174490.399836.1379517121348.JavaMail.root@trovaprezzi.it>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox