Re: [HACKERS] New error code to track unsupported contexts
Pushed this. -- Álvaro Herrerahttp://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] New error code to track unsupported contexts
2015-04-09 3:45 GMT+09:00 Alvaro Herrera alvhe...@2ndquadrant.com: Pushed this. Thanks! -- Michael -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] New error code to track unsupported contexts
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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
Re: [HACKERS] New error code to track unsupported contexts
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 Herrerahttp://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers
[HACKERS] New error code to track unsupported contexts
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 diff --git a/src/backend/commands/event_trigger.c b/src/backend/commands/event_trigger.c index 6a3002f..154bed9 100644 --- a/src/backend/commands/event_trigger.c +++ b/src/backend/commands/event_trigger.c @@ -1218,7 +1218,7 @@ pg_event_trigger_dropped_objects(PG_FUNCTION_ARGS) if (!currentEventTriggerState || !currentEventTriggerState-in_sql_drop) ereport(ERROR, -(errcode(ERRCODE_FEATURE_NOT_SUPPORTED), +(errcode(ERRCODE_CONTEXT_NOT_SUPPORTED), errmsg(%s can only be called in a sql_drop event trigger function, pg_event_trigger_dropped_objects(; diff --git a/src/backend/utils/errcodes.txt b/src/backend/utils/errcodes.txt index 62ba092..dcd8489 100644 --- a/src/backend/utils/errcodes.txt +++ b/src/backend/utils/errcodes.txt @@ -114,6 +114,7 @@ Section: Class 09 - Triggered Action Exception Section: Class 0A - Feature Not Supported 0A000EERRCODE_FEATURE_NOT_SUPPORTED feature_not_supported +0A001EERRCODE_CONTEXT_NOT_SUPPORTED context_not_supported Section: Class 0B - Invalid Transaction Initiation -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers