On 2018-03-09 17:44:15 -0500, Tom Lane wrote:
> "David G. Johnston" <david.g.johnston@gmail.com> writes:
> > 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.
>
> > 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.
>
> This isn't specific to ERRCODE_WARNING_DEPRECATED_FEATURE; if you look
> at generate-plerrcodes.pl you'll see it only collects error codes, not
> warning codes, for use in plpgsql's mapping table. It's documented, too:
> Appendix A says
>
> (Note that PL/pgSQL does not recognize warning, as opposed to error,
> condition names; those are classes 00, 01, and 02.)
>
> I'm not entirely sure why we have this errcode at all, as it doesn't
> seem to be used anywhere.
It used to be used till:
commit 975e27377aadcabab6504155c091d27ea2fa4c53
Author: Neil Conway <neilc@samurai.com>
Date: 2005-02-11 04:09:05 +0000
Adjust input routines for float4, float8 and oid to reject the empty string
as valid input (it was previously treated as 0). This input was deprecated
in 8.0 (and a warning was emitted). Regression tests updated.
and was introduced in
commit 2146bfc869bfd4967b0bbf260f386344f02506b9
Author: Neil Conway <neilc@samurai.com>
Date: 2004-03-04 21:47:18 +0000
Emit a warning when an empty string is input to the oid, float4, and
float8 types. This begins the deprecation of this feature: in 7.6,
this input will be rejected.
Also added a new error code for warnings about deprecated features,
and updated the regression tests.
there appears to never have been another user.
While it wasn't used for ~12 years, it seems like a useful
concept. OTOH, we've tried hard to avoid warnings like that due to the
log spam...
- Andres