Re: proposal: catch warnings

Поиск
Список
Период
Сортировка
Искать
От
Pavel Stehule
Тема
Re: proposal: catch warnings
Дата
Msg-id
BAY20-F181A3FE2E1B42E84F0C927F9BD0@phx.gbl
Ответ на
Список
Дерево обсуждения
proposal: catch warnings "Pavel Stehule" <pavel.stehule@hotmail.com>
Re: proposal: catch warnings "Simon Riggs" <simon@2ndquadrant.com>
Re: proposal: catch warnings "Pavel Stehule" <pavel.stehule@hotmail.com>
Re: proposal: catch warnings "Simon Riggs" <simon@2ndquadrant.com>
Re: proposal: catch warnings "Pavel Stehule" <pavel.stehule@hotmail.com>
Re: proposal: catch warnings Tom Lane <tgl@sss.pgh.pa.us>
Re: proposal: catch warnings "Pavel Stehule" <pavel.stehule@hotmail.com>
Re: proposal: catch warnings Tom Lane <tgl@sss.pgh.pa.us>
Re: proposal: catch warnings "Pavel Stehule" <pavel.stehule@hotmail.com>
What is problem? ANSI SQL has different model of handling exception than 
postgresql. It doesn't distinguishes between warnings and exception. Simply 
some sqlstate clases are reservated for warnings and other's for exception. 
But all sqlstate's (without '00000') can be handled via any CONTINUE, EXIT 
or UNDO handler. Exceptions are not problem. But I cannot map sqlstates 
'01xxx' and '02xxx' to exception because they internally do rollback. I have 
to use different elevel. I cannot trap warnings on plpgpsm level, because in 
this moment I will lost an possibility of traping warnings from others PL. I 
can use warning for signaling any safe event (don't need rollaback) from 
this PL. Currently I save only last warning, but it is possible safe 
warnings info to any queue.
>
>What in the world does it mean to "catch" a warning?  If your intention
>is to process arbitrary user-defined code while inside the error
>subsystem, I can tell you right now that it's unlikely to work.
>
No, it means, it process user-defined code related to some compound 
statement immediate after some statement which signals sqlstate '01xxx' or 
'02xxx'. Exceptions are diffrent, they do rollback before call exception's 
handle. I use callback function only for decision if there is any possible 
warning handler and for saving struct edata. After excecuton any statement I 
check this struct and call handler statement.
> > Simply solution's is adding one callback  to
> > error's processing of errors on level WARNING.
>

>I can't get excited about hooks that are defined in such a way that
>there can be only one user of the hook ... if it's useful to you,
>it's probably useful to someone else too.
>

Propably we can use it for faster catch no_data in plpgsql or for enhancing 
of statement RAISE in future. Any SQL/PSM implementation have to solve this 
task.

Regards
Pavel Stehule

_________________________________________________________________
Emotikony a pozadi programu MSN Messenger ozivi vasi konverzaci. 
http://messenger.msn.cz/


В списке pgsql-hackers по дате отправления
От: Tom Lane
Дата:
От: Seneca Cunningham
Дата:
FAQ