Re: Catch exceptions outside function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
A: "Roberto Grandi" <roberto.grandi@xxxxxxxxxxxxxx>, pgsql-admin@xxxxxxxxxxxxxx
Inviato: Mercoledì, 18 settembre 2013 15:37:12
Oggetto: RE: Catch exceptions outside function

> -----Original Message-----
> From: pgsql-admin-owner@xxxxxxxxxxxxxx [mailto:pgsql-admin-
> owner@xxxxxxxxxxxxxx] On Behalf Of Roberto Grandi
> Sent: Wednesday, September 18, 2013 6:17 AM
> To: pgsql-admin@xxxxxxxxxxxxxx
> Subject:  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@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux