Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1euQVT-0005V9-MW for pgsql-bugs@arkaria.postgresql.org; Fri, 09 Mar 2018 22:28:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1euQVS-0006rn-6a for pgsql-bugs@arkaria.postgresql.org; Fri, 09 Mar 2018 22:28:54 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1euQVR-0006rT-Pj for pgsql-bugs@lists.postgresql.org; Fri, 09 Mar 2018 22:28:54 +0000 Received: from mail-ot0-x242.google.com ([2607:f8b0:4003:c0f::242]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1euQVO-0007Im-UK for pgsql-bugs@postgresql.org; Fri, 09 Mar 2018 22:28:52 +0000 Received: by mail-ot0-x242.google.com with SMTP id l5so10075044otf.9 for ; Fri, 09 Mar 2018 14:28:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=ek781PgtwoPr1OoxtOSE8orew14VhD+f4ONylL7IldU=; b=tJ8RyD+GEQnUBJYuDJy38JCc4lB3FAwk8B5T00ee8zgASrf9SPQ4+YdrUn+EEQtMJk kqk9s1T3KhNFXlqT0TtRUeBamodvBSRC45pb+hPe0R1gKGJ4r2V6jq2v1tkhasnm0Ubq PKI0GEtjyGUgZ0jzbO2H3+9lwdGicfOxKGo/yTOmblq4QI+/kJFpNnB13ipS0YwN/sFo ypBCeIJr5VwSpBEkXfSdMWSMbFh3i+AIgmWL1fKeUtDqq5UQIJDs7LYw92B5a2YD0Es9 8V7F3zi6FarPCw15ArOtCwLRa7RxjaOB8cNcyGMgMCgQuH4EfF3B4ewlGMUR4DwLfdS0 Vd6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=ek781PgtwoPr1OoxtOSE8orew14VhD+f4ONylL7IldU=; b=MJC1byZpkTAP9FoCg4trCKVKl9LyupwZRFdH65mPOvYu93iAY4VojlHtTPB4XHqwx1 9FMWcR3c+qm5NGW+g9g2IV/2OB5MS/3O/oyUURXmCSAkJkdcManlRAkWV8im9H7XYqat Dmhx7x5+j/BwtwqbMbuwZ6DG4UyajemxvWo/PxmAUbtdPlZrTg6/yEcQGMSN8PjNAfD7 JTR8u6bCKPC+irJUhlHqUcHGgv80ol3ihXEfPDf3K6ueBMJC1XTky7GNq1NF5A2I5gNp UtJDqg7FfBWxy2Dc3SK1l9aFaf/nLlLjsqtmUWVsW028wCaN+sD0q6FqiOTJcvcHrBx7 oG4w== X-Gm-Message-State: AElRT7E0H4lCBHKCn2fkNUy5sL+3qtUDWO55Y1SNDRYYGkAVqRIw3P/j mXTErSl3vqW/Zw8fAvs9LZm6jjX1CAxOBO8+qNk= X-Google-Smtp-Source: AG47ELskXJG3watjksaR3diHw30oKPnAtT1qaoWWwHLPeLFUW5z48qW2l95KXNvyocOv3X7WIJI9aWVDdiCGIWkLvFI= X-Received: by 10.157.2.137 with SMTP id 9mr39179otl.81.1520634528991; Fri, 09 Mar 2018 14:28:48 -0800 (PST) MIME-Version: 1.0 Received: by 10.201.56.130 with HTTP; Fri, 9 Mar 2018 14:28:48 -0800 (PST) In-Reply-To: References: From: Kouber Saparev Date: Sat, 10 Mar 2018 00:28:48 +0200 Message-ID: Subject: Re: Unrecognized exception condition "deprecated_feature" To: "David G. Johnston" Cc: Postgres Bug Content-Type: multipart/alternative; boundary="94eb2c09c8c2ef1085056702507a" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --94eb2c09c8c2ef1085056702507a Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Here's a working example with 'unique_violation' for instance: postgres=3D# DO $$ BEGIN RAISE WARNING 'Example of working exception condition' USING ERRCODE =3D 'unique_violation'; END; $$; WARNING: Example of working exception condition DO postgres=3D# DO $$ BEGIN RAISE WARNING 'Example of working exception condition (with code)' USING ERRCODE =3D '23505'; END; $$; WARNING: Example of working exception condition (with code) DO postgres=3D# select error_severity, message from sqlog.log('today') where sql_state_code =3D '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 : > On Fri, Mar 9, 2018 at 11:55 AM, Kouber Saparev wrote: > >> For some reason using an error code of 'deprecated_feature' does not >> work, while its equivalent '01P01' works just fine. >> >> kouber=3D# DO $$ >> BEGIN >> RAISE WARNING 'Deprecated' >> USING ERRCODE =3D 'deprecated_feature'; >> END; >> $$; >> ERROR: unrecognized exception condition "deprecated_feature" >> CONTEXT: PL/pgSQL function inline_code_block line 3 at RAISE >> >> kouber=3D# DO $$ >> BEGIN >> RAISE WARNING 'Deprecated' >> USING ERRCODE =3D '01P01'; >> >> =E2=80=8B[...]=E2=80=8B > >> 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 fixe= d >> in 10.2 or 10.3. >> > > =E2=80=8BWhile I haven't looked at the source code or docs for this I'm w= ondering > 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 lab= el > representing it would not be.=E2=80=8B The two are not likely to be > interchangeable. Have you found working code where this is does work as > you expect? > > David J. > > --94eb2c09c8c2ef1085056702507a Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Here's a working example with 'unique_violation= 9; for instance:

postgres=3D# DO $$=C2=A0
BEGIN=C2=A0
=C2=A0RAISE WARNING 'Example of working exceptio= n condition' =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0
=C2=A0 =C2=A0USIN= G ERRCODE =3D 'unique_violation';=C2=A0
END;=C2=A0
<= div>$$;
WARNING: =C2=A0Example of working exception condition
DO

postgres=3D# DO $$=C2=A0
BEGIN= =C2=A0
=C2=A0RAISE WARNING 'Example of working exception cond= ition (with code)'=C2=A0
=C2=A0 =C2=A0USING ERRCODE =3D '= 23505';=C2=A0
END;=C2=A0
$$;
WARNING: =C2= =A0Example of working exception condition (with code)
DO

postgres=3D# select error_severity, message from sqlog.log= ('today') where sql_state_code =3D '23505';
=C2= =A0error_severity | =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0message =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0
----------------+----------= ------------------------------------------
=C2=A0WARNING =C2=A0 = =C2=A0 =C2=A0 =C2=A0| Example of working exception condition
=C2= =A0WARNING =C2=A0 =C2=A0 =C2=A0 =C2=A0| Example of working exception condit= ion (with code)
(2 rows)

2018-03-09 21:00 GMT+02:00 David G. John= ston <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=3D# DO $$=C2=A0
B= EGIN=C2=A0
=C2=A0RAISE WARNING &#= 39;Deprecated'=C2=A0
=C2=A0 = =C2=A0USING ERRCODE =3D 'deprecated_feature';=C2=A0
END;=C2=A0
$$;=C2=A0
ERROR: =C2=A0unrec= ognized exception condition "deprecated_feature"=C2=A0
CONTEXT: =C2=A0PL/pgSQL function inline_cod= e_block line 3 at RAISE

kouber=3D# DO $$=C2=A0
BEGIN=C2=A0
=C2=A0RAISE WARNING 'Deprecated'=C2=A0
=C2=A0 =C2=A0USING ERRCODE =3D '01P01'; =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0

=E2=80=8B[...]=E2=80=8B
kouber@spectre:~/src/postgres$ grep -r deprecated_featu= re . =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0
./src/backend/utils/errcodes.txt:01P= 01 =C2=A0 =C2=A0W =C2=A0 =C2=A0ERRCODE_WARNING_DEPRECATED_FEATURE =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 deprecated_feature

I am using Po= stgreSQL 10.1, I apologize in case it has already been fixed in 10.2 or 10.= 3.

=E2=80=8BWhile I= haven't looked at the source code or docs for this I'm wondering w= hy you believe this is a bug in the first place.=C2=A0 If "01P01"= is a valid and expected value for ERRCODE I would expect that the textual = string label representing it would not be.=E2=80=8B=C2=A0 The two are not l= ikely to be interchangeable.=C2=A0 Have you found working code where this i= s does work as you expect?

David J.

=

--94eb2c09c8c2ef1085056702507a--