From: Kouber Saparev <kouber@gmail.com>
To: David G. Johnston <david.g.johnston@gmail.com>
Cc: Postgres Bug <pgsql-bugs@postgresql.org>
Subject: Re: Unrecognized exception condition "deprecated_feature"
Date: Sat, 10 Mar 2018 00:28:48 +0200
Message-ID: <CAN4RuQtCwLs4vX6GCCO2_Mdp+kh7gJbY3A-uzB5o4MM0bsbqjw@mail.gmail.com> (raw)
In-Reply-To: <CAKFQuwYeV7WRO6NK8-eEO0jHLtgkSqG3QnrhrxwmHcy9U0XErQ@mail.gmail.com>
References: <CAN4RuQvC3OGXv8bWEiRO_PQbgGeTLyw5e78q0cQEkXPSsczAYg@mail.gmail.com>
<CAKFQuwYeV7WRO6NK8-eEO0jHLtgkSqG3QnrhrxwmHcy9U0XErQ@mail.gmail.com>
Here's a working example with 'unique_violation' for instance:
postgres=# DO $$
BEGIN
RAISE WARNING 'Example of working exception condition'
USING ERRCODE = 'unique_violation';
END;
$$;
WARNING: Example of working exception condition
DO
postgres=# DO $$
BEGIN
RAISE WARNING 'Example of working exception condition (with code)'
USING ERRCODE = '23505';
END;
$$;
WARNING: Example of working exception condition (with code)
DO
postgres=# select error_severity, message from sqlog.log('today') where
sql_state_code = '23505';
error_severity | message
----------------+----------------------------------------------------
WARNING | Example of working exception condition
WARNING | Example of working exception condition (with code)
(2 rows)
2018-03-09 21:00 GMT+02:00 David G. Johnston <david.g.johnston@gmail.com>:
> On Fri, Mar 9, 2018 at 11:55 AM, Kouber Saparev <kouber@gmail.com> wrote:
>
>> For some reason using an error code of 'deprecated_feature' does not
>> work, while its equivalent '01P01' works just fine.
>>
>> kouber=# DO $$
>> BEGIN
>> RAISE WARNING 'Deprecated'
>> USING ERRCODE = 'deprecated_feature';
>> END;
>> $$;
>> ERROR: unrecognized exception condition "deprecated_feature"
>> CONTEXT: PL/pgSQL function inline_code_block line 3 at RAISE
>>
>> kouber=# DO $$
>> BEGIN
>> RAISE WARNING 'Deprecated'
>> USING ERRCODE = '01P01';
>>
>> [...]
>
>> kouber@spectre:~/src/postgres$ grep -r deprecated_feature .
>>
>> ./src/backend/utils/errcodes.txt:01P01 W
>> ERRCODE_WARNING_DEPRECATED_FEATURE
>> deprecated_feature
>>
>> I am using PostgreSQL 10.1, I apologize in case it has already been fixed
>> in 10.2 or 10.3.
>>
>
> While I haven't looked at the source code or docs for this I'm wondering
> why you believe this is a bug in the first place. If "01P01" is a valid
> and expected value for ERRCODE I would expect that the textual string label
> representing it would not be. The two are not likely to be
> interchangeable. Have you found working code where this is does work as
> you expect?
>
> David J.
>
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: kouber@gmail.com, david.g.johnston@gmail.com
Subject: Re: Unrecognized exception condition "deprecated_feature"
In-Reply-To: <CAN4RuQtCwLs4vX6GCCO2_Mdp+kh7gJbY3A-uzB5o4MM0bsbqjw@mail.gmail.com>
References: <CAN4RuQvC3OGXv8bWEiRO_PQbgGeTLyw5e78q0cQEkXPSsczAYg@mail.gmail.com> <CAKFQuwYeV7WRO6NK8-eEO0jHLtgkSqG3QnrhrxwmHcy9U0XErQ@mail.gmail.com> <CAN4RuQtCwLs4vX6GCCO2_Mdp+kh7gJbY3A-uzB5o4MM0bsbqjw@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox