Re: Catch exceptions outside function

Поиск
Список
Период
Сортировка
От Igor Neyman
Тема Re: Catch exceptions outside function
Дата
Msg-id A76B25F2823E954C9E45E32FA49D70EC4281FF26@mail.corp.perceptron.com
обсуждение исходный текст
Ответ на Catch exceptions outside function  (Roberto Grandi <roberto.grandi@trovaprezzi.it>)
Ответы Re: Catch exceptions outside function  (Roberto Grandi <roberto.grandi@trovaprezzi.it>)
Список pgsql-admin
> -----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
plpgsqlfunction in 8.3.
 

OTOH, starting with 9.0 you can use anonymous plpgsql blocks, and get what you asked for.

Regards,
Igor Neyman




В списке pgsql-admin по дате отправления:

Предыдущее
От: Scott Ribe
Дата:
Сообщение: Re: Catch exceptions outside function
Следующее
От: Scott Ribe
Дата:
Сообщение: Re: Catch exceptions outside function