New error code to track unsupported contexts

Lists: pgsql-hackers
From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: New error code to track unsupported contexts
Date: 2014-11-29 05:41:47
Message-ID: CAB7nPqQ-5NAkHQHh_NOm7FPep37NCiLKwPoJ2Yxb8TDoGgbYYA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi all,

When pg_event_trigger_dropped_objects is run in a context that is not
the one of an event trigger, currently the error code
ERRCODE_FEATURE_NOT_SUPPORTED is returned. Wouldn't it be better to
have an error to define an out-of-context instead? It seems that it
would be a good thing to have more error verbosity for situations like
the case above. Note that this idea has been mentioned on this ML a
couple of weeks back. In any case, attached is a patch showing the
idea.

Opinions? Is that worth having?
Regards,
--
Michael

Attachment Content-Type Size
20141129_context_error_code.patch text/x-diff 1.1 KB

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: New error code to track unsupported contexts
Date: 2015-04-07 22:42:34
Message-ID: 55245D5A.5000500@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 11/28/14 11:41 PM, Michael Paquier wrote:
> Hi all,
>
> When pg_event_trigger_dropped_objects is run in a context that is not
> the one of an event trigger, currently the error code
> ERRCODE_FEATURE_NOT_SUPPORTED is returned. Wouldn't it be better to
> have an error to define an out-of-context instead? It seems that it
> would be a good thing to have more error verbosity for situations like
> the case above. Note that this idea has been mentioned on this ML a
> couple of weeks back. In any case, attached is a patch showing the
> idea.
>
> Opinions? Is that worth having?

Anything ever happen with this? (FWIW, I'm in favor of it. Reporting the
feature isn't supported is confusing...)
--
Jim Nasby, Data Architect, Blue Treble Consulting
Data in Trouble? Get it in Treble! http://BlueTreble.com


From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: New error code to track unsupported contexts
Date: 2015-04-08 01:21:27
Message-ID: 20150408012127.GQ4369@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Jim Nasby wrote:
> On 11/28/14 11:41 PM, Michael Paquier wrote:
> >Hi all,
> >
> >When pg_event_trigger_dropped_objects is run in a context that is not
> >the one of an event trigger, currently the error code
> >ERRCODE_FEATURE_NOT_SUPPORTED is returned. Wouldn't it be better to
> >have an error to define an out-of-context instead? It seems that it
> >would be a good thing to have more error verbosity for situations like
> >the case above. Note that this idea has been mentioned on this ML a
> >couple of weeks back. In any case, attached is a patch showing the
> >idea.
> >
> >Opinions? Is that worth having?
>
> Anything ever happen with this? (FWIW, I'm in favor of it. Reporting the
> feature isn't supported is confusing...)

Not opposed to the idea.

Maybe it should be in class 39 'External Routine Invocation Exception'
instead, like ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED is used by
various trigger functions. We could invent
ERRCODE_E_R_I_E_EVENT_TRIGGER_PROTOCOL_VIOLATED with value 39P03, for
example.

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: New error code to track unsupported contexts
Date: 2015-04-08 05:30:35
Message-ID: CAB7nPqQ80F-t4W2jRCNOXxMk4zgZ7K0rDcvx+eNNFojWEDDhBA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Wed, Apr 8, 2015 at 10:21 AM, Alvaro Herrera
<alvherre(at)2ndquadrant(dot)com> wrote:
> Jim Nasby wrote:
>> On 11/28/14 11:41 PM, Michael Paquier wrote:
>> >Hi all,
>> >
>> >When pg_event_trigger_dropped_objects is run in a context that is not
>> >the one of an event trigger, currently the error code
>> >ERRCODE_FEATURE_NOT_SUPPORTED is returned. Wouldn't it be better to
>> >have an error to define an out-of-context instead? It seems that it
>> >would be a good thing to have more error verbosity for situations like
>> >the case above. Note that this idea has been mentioned on this ML a
>> >couple of weeks back. In any case, attached is a patch showing the
>> >idea.
>> >
>> >Opinions? Is that worth having?
>>
>> Anything ever happen with this? (FWIW, I'm in favor of it. Reporting the
>> feature isn't supported is confusing...)

This got lost in translation..

> Not opposed to the idea.
>
> Maybe it should be in class 39 'External Routine Invocation Exception'
> instead, like ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED is used by
> various trigger functions. We could invent
> ERRCODE_E_R_I_E_EVENT_TRIGGER_PROTOCOL_VIOLATED with value 39P03, for
> example.

This looks fine to me, in the spirit of
ERRCODE_E_R_I_E_TRIGGER_PROTOCOL_VIOLATED. A refreshed patch gives the
attached, taking into account the event table_rewrite.
Regards,
--
Michael

Attachment Content-Type Size
20150407_context_error_code_v2.patch application/x-patch 2.1 KB

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: New error code to track unsupported contexts
Date: 2015-04-08 18:45:26
Message-ID: 20150408184525.GU4369@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Pushed this.

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: New error code to track unsupported contexts
Date: 2015-04-08 23:51:08
Message-ID: CAB7nPqRrA-Pav0N70RtKz1Ufer4LCk-niqWwKK6WT02nXTxh9g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

2015-04-09 3:45 GMT+09:00 Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>:
> Pushed this.

Thanks!
--
Michael