pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Unrecognized exception condition "deprecated_feature"
14+ messages / 7 participants
[nested] [flat]

Commits from this thread:
  2018-04-05 1fd8690668  Install errcodes.txt for use by extensions.
* Unrecognized exception condition "deprecated_feature"
@ 2018-03-09 18:55 Kouber Saparev <kouber@gmail.com>
  2018-03-09 19:00 ` Re: Unrecognized exception condition "deprecated_feature" David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 1 reply; 14+ messages in thread

From: Kouber Saparev @ 2018-03-09 18:55 UTC (permalink / raw)
  To: pgsql-bugs

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';
END;
$$;
WARNING:  Deprecated
DO

The thing that is making this issue quite strange is that I see that string
well defined in the source code (and copy/pasted it from there, as well as
from the docs, yet the result remains the same).

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.

Regards,
--
Kouber Saparev

^ permalink  raw  reply  [nested|flat] 14+ messages in thread

* Re: Unrecognized exception condition "deprecated_feature"
  2018-03-09 18:55 Unrecognized exception condition "deprecated_feature" Kouber Saparev <kouber@gmail.com>
@ 2018-03-09 19:00 ` David G. Johnston <david.g.johnston@gmail.com>
  2018-03-09 22:28   ` Re: Unrecognized exception condition "deprecated_feature" Kouber Saparev <kouber@gmail.com>
  2018-03-09 22:44   ` Re: Unrecognized exception condition "deprecated_feature" Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 2 replies; 14+ messages in thread

From: David G. Johnston @ 2018-03-09 19:00 UTC (permalink / raw)
  To: Kouber Saparev <kouber@gmail.com>; +Cc: pgsql-bugs

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.

^ permalink  raw  reply  [nested|flat] 14+ messages in thread

* Re: Unrecognized exception condition "deprecated_feature"
  2018-03-09 18:55 Unrecognized exception condition "deprecated_feature" Kouber Saparev <kouber@gmail.com>
  2018-03-09 19:00 ` Re: Unrecognized exception condition "deprecated_feature" David G. Johnston <david.g.johnston@gmail.com>
@ 2018-03-09 22:28   ` Kouber Saparev <kouber@gmail.com>
  1 sibling, 0 replies; 14+ messages in thread

From: Kouber Saparev @ 2018-03-09 22:28 UTC (permalink / raw)
  To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: pgsql-bugs

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.
>
>

^ permalink  raw  reply  [nested|flat] 14+ messages in thread

* Re: Unrecognized exception condition "deprecated_feature"
  2018-03-09 18:55 Unrecognized exception condition "deprecated_feature" Kouber Saparev <kouber@gmail.com>
  2018-03-09 19:00 ` Re: Unrecognized exception condition "deprecated_feature" David G. Johnston <david.g.johnston@gmail.com>
@ 2018-03-09 22:44   ` Tom Lane <tgl@sss.pgh.pa.us>
  2018-03-09 23:07     ` Re: Unrecognized exception condition "deprecated_feature" Kouber Saparev <kouber@gmail.com>
  2018-03-10 00:17     ` Re: Unrecognized exception condition "deprecated_feature" Andres Freund <andres@anarazel.de>
  1 sibling, 2 replies; 14+ messages in thread

From: Tom Lane @ 2018-03-09 22:44 UTC (permalink / raw)
  To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: Kouber Saparev <kouber@gmail.com>; pgsql-bugs

"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.

			regards, tom lane




^ permalink  raw  reply  [nested|flat] 14+ messages in thread

* Re: Unrecognized exception condition "deprecated_feature"
  2018-03-09 18:55 Unrecognized exception condition "deprecated_feature" Kouber Saparev <kouber@gmail.com>
  2018-03-09 19:00 ` Re: Unrecognized exception condition "deprecated_feature" David G. Johnston <david.g.johnston@gmail.com>
  2018-03-09 22:44   ` Re: Unrecognized exception condition "deprecated_feature" Tom Lane <tgl@sss.pgh.pa.us>
@ 2018-03-09 23:07     ` Kouber Saparev <kouber@gmail.com>
  1 sibling, 0 replies; 14+ messages in thread

From: Kouber Saparev @ 2018-03-09 23:07 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: David G. Johnston <david.g.johnston@gmail.com>; pgsql-bugs

2018-03-10 0:44 GMT+02:00 Tom Lane <tgl@sss.pgh.pa.us>:

> 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.)
>

Indeed.

next unless $type eq 'E';

The only exception is 'string_data_right_truncation' (01004) because
actually it is duplicated further (22001).

Thanks for the clarification!

--
Kouber Saparev

^ permalink  raw  reply  [nested|flat] 14+ messages in thread

* Re: Unrecognized exception condition "deprecated_feature"
  2018-03-09 18:55 Unrecognized exception condition "deprecated_feature" Kouber Saparev <kouber@gmail.com>
  2018-03-09 19:00 ` Re: Unrecognized exception condition "deprecated_feature" David G. Johnston <david.g.johnston@gmail.com>
  2018-03-09 22:44   ` Re: Unrecognized exception condition "deprecated_feature" Tom Lane <tgl@sss.pgh.pa.us>
@ 2018-03-10 00:17     ` Andres Freund <andres@anarazel.de>
  2018-03-10 00:42       ` Re: Unrecognized exception condition "deprecated_feature" Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 1 reply; 14+ messages in thread

From: Andres Freund @ 2018-03-10 00:17 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: David G. Johnston <david.g.johnston@gmail.com>; Kouber Saparev <kouber@gmail.com>; pgsql-bugs

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




^ permalink  raw  reply  [nested|flat] 14+ messages in thread

* Re: Unrecognized exception condition "deprecated_feature"
  2018-03-09 18:55 Unrecognized exception condition "deprecated_feature" Kouber Saparev <kouber@gmail.com>
  2018-03-09 19:00 ` Re: Unrecognized exception condition "deprecated_feature" David G. Johnston <david.g.johnston@gmail.com>
  2018-03-09 22:44   ` Re: Unrecognized exception condition "deprecated_feature" Tom Lane <tgl@sss.pgh.pa.us>
  2018-03-10 00:17     ` Re: Unrecognized exception condition "deprecated_feature" Andres Freund <andres@anarazel.de>
@ 2018-03-10 00:42       ` Tom Lane <tgl@sss.pgh.pa.us>
  2018-03-10 00:55         ` Re: Unrecognized exception condition "deprecated_feature" Andres Freund <andres@anarazel.de>
  2018-03-10 02:12         ` Re: Unrecognized exception condition "deprecated_feature" Andrew Gierth <andrew@tao11.riddles.org.uk>
  0 siblings, 2 replies; 14+ messages in thread

From: Tom Lane @ 2018-03-10 00:42 UTC (permalink / raw)
  To: Andres Freund <andres@anarazel.de>; +Cc: David G. Johnston <david.g.johnston@gmail.com>; Kouber Saparev <kouber@gmail.com>; pgsql-bugs

Andres Freund <andres@anarazel.de> writes:
> On 2018-03-09 17:44:15 -0500, Tom Lane wrote:
>> 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:
> ...
> 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...

Yeah, I'm not that excited about removing it.  Probably a more useful
thing to debate is whether we ought to change the policy about omitting
warning conditions from plpgsql's conversion list.  While the core code
hasn't got a use for that (since we never actually throw errors with such
SQLSTATEs), this complaint seems to indicate that users would like to use
them in RAISE.

(I'd still skip "success" conditions, like 00000, in any case.)

			regards, tom lane




^ permalink  raw  reply  [nested|flat] 14+ messages in thread

* Re: Unrecognized exception condition "deprecated_feature"
  2018-03-09 18:55 Unrecognized exception condition "deprecated_feature" Kouber Saparev <kouber@gmail.com>
  2018-03-09 19:00 ` Re: Unrecognized exception condition "deprecated_feature" David G. Johnston <david.g.johnston@gmail.com>
  2018-03-09 22:44   ` Re: Unrecognized exception condition "deprecated_feature" Tom Lane <tgl@sss.pgh.pa.us>
  2018-03-10 00:17     ` Re: Unrecognized exception condition "deprecated_feature" Andres Freund <andres@anarazel.de>
  2018-03-10 00:42       ` Re: Unrecognized exception condition "deprecated_feature" Tom Lane <tgl@sss.pgh.pa.us>
@ 2018-03-10 00:55         ` Andres Freund <andres@anarazel.de>
  1 sibling, 0 replies; 14+ messages in thread

From: Andres Freund @ 2018-03-10 00:55 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: David G. Johnston <david.g.johnston@gmail.com>; Kouber Saparev <kouber@gmail.com>; pgsql-bugs

On 2018-03-09 19:42:26 -0500, Tom Lane wrote:
> While the core code hasn't got a use for that (since we never actually
> throw errors with such SQLSTATEs), this complaint seems to indicate
> that users would like to use them in RAISE.

I think that's a fair argument, and given we don't duplicate the lists
anymore, the effort for doing so seems trivial enough.  +0.5

- Andres




^ permalink  raw  reply  [nested|flat] 14+ messages in thread

* Re: Unrecognized exception condition "deprecated_feature"
  2018-03-09 18:55 Unrecognized exception condition "deprecated_feature" Kouber Saparev <kouber@gmail.com>
  2018-03-09 19:00 ` Re: Unrecognized exception condition "deprecated_feature" David G. Johnston <david.g.johnston@gmail.com>
  2018-03-09 22:44   ` Re: Unrecognized exception condition "deprecated_feature" Tom Lane <tgl@sss.pgh.pa.us>
  2018-03-10 00:17     ` Re: Unrecognized exception condition "deprecated_feature" Andres Freund <andres@anarazel.de>
  2018-03-10 00:42       ` Re: Unrecognized exception condition "deprecated_feature" Tom Lane <tgl@sss.pgh.pa.us>
@ 2018-03-10 02:12         ` Andrew Gierth <andrew@tao11.riddles.org.uk>
  2018-03-10 02:19           ` Re: Unrecognized exception condition "deprecated_feature" Andres Freund <andres@anarazel.de>
  1 sibling, 1 reply; 14+ messages in thread

From: Andrew Gierth @ 2018-03-10 02:12 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Andres Freund <andres@anarazel.de>; David G. Johnston <david.g.johnston@gmail.com>; Kouber Saparev <kouber@gmail.com>; pgsql-bugs

>>>>> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:

 Tom> Yeah, I'm not that excited about removing it. Probably a more
 Tom> useful thing to debate is whether we ought to change the policy
 Tom> about omitting warning conditions from plpgsql's conversion list.
 Tom> While the core code hasn't got a use for that (since we never
 Tom> actually throw errors with such SQLSTATEs), this complaint seems
 Tom> to indicate that users would like to use them in RAISE.

While we're on the topic, I know of at least one other author of a
non-core PL (besides myself) that has been frustrated by the fact that
errcodes.txt is not installed anywhere, making it impossible to
autogenerate a plerrcodes.h file in the extension build process.

-- 
Andrew (irc:RhodiumToad)




^ permalink  raw  reply  [nested|flat] 14+ messages in thread

* Re: Unrecognized exception condition "deprecated_feature"
  2018-03-09 18:55 Unrecognized exception condition "deprecated_feature" Kouber Saparev <kouber@gmail.com>
  2018-03-09 19:00 ` Re: Unrecognized exception condition "deprecated_feature" David G. Johnston <david.g.johnston@gmail.com>
  2018-03-09 22:44   ` Re: Unrecognized exception condition "deprecated_feature" Tom Lane <tgl@sss.pgh.pa.us>
  2018-03-10 00:17     ` Re: Unrecognized exception condition "deprecated_feature" Andres Freund <andres@anarazel.de>
  2018-03-10 00:42       ` Re: Unrecognized exception condition "deprecated_feature" Tom Lane <tgl@sss.pgh.pa.us>
  2018-03-10 02:12         ` Re: Unrecognized exception condition "deprecated_feature" Andrew Gierth <andrew@tao11.riddles.org.uk>
@ 2018-03-10 02:19           ` Andres Freund <andres@anarazel.de>
  2018-03-10 02:24             ` Re: Unrecognized exception condition "deprecated_feature" Alvaro Herrera <alvherre@alvh.no-ip.org>
  0 siblings, 1 reply; 14+ messages in thread

From: Andres Freund @ 2018-03-10 02:19 UTC (permalink / raw)
  To: Andrew Gierth <andrew@tao11.riddles.org.uk>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; David G. Johnston <david.g.johnston@gmail.com>; Kouber Saparev <kouber@gmail.com>; pgsql-bugs

On 2018-03-10 02:12:39 +0000, Andrew Gierth wrote:
> >>>>> "Tom" == Tom Lane <tgl@sss.pgh.pa.us> writes:
> 
>  Tom> Yeah, I'm not that excited about removing it. Probably a more
>  Tom> useful thing to debate is whether we ought to change the policy
>  Tom> about omitting warning conditions from plpgsql's conversion list.
>  Tom> While the core code hasn't got a use for that (since we never
>  Tom> actually throw errors with such SQLSTATEs), this complaint seems
>  Tom> to indicate that users would like to use them in RAISE.
> 
> While we're on the topic, I know of at least one other author of a
> non-core PL (besides myself) that has been frustrated by the fact that
> errcodes.txt is not installed anywhere, making it impossible to
> autogenerate a plerrcodes.h file in the extension build process.

Seems entirely reasonable to install it from my POV.

Greetings,

Andres Freund




^ permalink  raw  reply  [nested|flat] 14+ messages in thread

* Re: Unrecognized exception condition "deprecated_feature"
  2018-03-09 18:55 Unrecognized exception condition "deprecated_feature" Kouber Saparev <kouber@gmail.com>
  2018-03-09 19:00 ` Re: Unrecognized exception condition "deprecated_feature" David G. Johnston <david.g.johnston@gmail.com>
  2018-03-09 22:44   ` Re: Unrecognized exception condition "deprecated_feature" Tom Lane <tgl@sss.pgh.pa.us>
  2018-03-10 00:17     ` Re: Unrecognized exception condition "deprecated_feature" Andres Freund <andres@anarazel.de>
  2018-03-10 00:42       ` Re: Unrecognized exception condition "deprecated_feature" Tom Lane <tgl@sss.pgh.pa.us>
  2018-03-10 02:12         ` Re: Unrecognized exception condition "deprecated_feature" Andrew Gierth <andrew@tao11.riddles.org.uk>
  2018-03-10 02:19           ` Re: Unrecognized exception condition "deprecated_feature" Andres Freund <andres@anarazel.de>
@ 2018-03-10 02:24             ` Alvaro Herrera <alvherre@alvh.no-ip.org>
  2018-03-29 00:41               ` Re: Unrecognized exception condition "deprecated_feature" Thomas Munro <thomas.munro@enterprisedb.com>
  0 siblings, 1 reply; 14+ messages in thread

From: Alvaro Herrera @ 2018-03-10 02:24 UTC (permalink / raw)
  To: Andres Freund <andres@anarazel.de>; +Cc: Andrew Gierth <andrew@tao11.riddles.org.uk>; Tom Lane <tgl@sss.pgh.pa.us>; David G. Johnston <david.g.johnston@gmail.com>; Kouber Saparev <kouber@gmail.com>; pgsql-bugs

Andres Freund wrote:
> On 2018-03-10 02:12:39 +0000, Andrew Gierth wrote:

> > While we're on the topic, I know of at least one other author of a
> > non-core PL (besides myself) that has been frustrated by the fact that
> > errcodes.txt is not installed anywhere, making it impossible to
> > autogenerate a plerrcodes.h file in the extension build process.
> 
> Seems entirely reasonable to install it from my POV.

+1

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




^ permalink  raw  reply  [nested|flat] 14+ messages in thread

* Re: Unrecognized exception condition "deprecated_feature"
  2018-03-09 18:55 Unrecognized exception condition "deprecated_feature" Kouber Saparev <kouber@gmail.com>
  2018-03-09 19:00 ` Re: Unrecognized exception condition "deprecated_feature" David G. Johnston <david.g.johnston@gmail.com>
  2018-03-09 22:44   ` Re: Unrecognized exception condition "deprecated_feature" Tom Lane <tgl@sss.pgh.pa.us>
  2018-03-10 00:17     ` Re: Unrecognized exception condition "deprecated_feature" Andres Freund <andres@anarazel.de>
  2018-03-10 00:42       ` Re: Unrecognized exception condition "deprecated_feature" Tom Lane <tgl@sss.pgh.pa.us>
  2018-03-10 02:12         ` Re: Unrecognized exception condition "deprecated_feature" Andrew Gierth <andrew@tao11.riddles.org.uk>
  2018-03-10 02:19           ` Re: Unrecognized exception condition "deprecated_feature" Andres Freund <andres@anarazel.de>
  2018-03-10 02:24             ` Re: Unrecognized exception condition "deprecated_feature" Alvaro Herrera <alvherre@alvh.no-ip.org>
@ 2018-03-29 00:41               ` Thomas Munro <thomas.munro@enterprisedb.com>
  2018-03-29 01:22                 ` Re: Unrecognized exception condition "deprecated_feature" Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 14+ messages in thread

From: Thomas Munro @ 2018-03-29 00:41 UTC (permalink / raw)
  To: Alvaro Herrera <alvherre@alvh.no-ip.org>; +Cc: Andres Freund <andres@anarazel.de>; Andrew Gierth <andrew@tao11.riddles.org.uk>; Tom Lane <tgl@sss.pgh.pa.us>; David G. Johnston <david.g.johnston@gmail.com>; Kouber Saparev <kouber@gmail.com>; pgsql-bugs

On Sat, Mar 10, 2018 at 3:24 PM, Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
> Andres Freund wrote:
>> On 2018-03-10 02:12:39 +0000, Andrew Gierth wrote:
>
>> > While we're on the topic, I know of at least one other author of a
>> > non-core PL (besides myself) that has been frustrated by the fact that
>> > errcodes.txt is not installed anywhere, making it impossible to
>> > autogenerate a plerrcodes.h file in the extension build process.
>>
>> Seems entirely reasonable to install it from my POV.
>
> +1

+1

Something like this?  Or I guess src/backend/Makefile could do it directly.

I've wanted this for an ancient PL I've been trying to restore.

-- 
Thomas Munro
http://www.enterprisedb.com

Attachments:

0001-Install-errcodes.txt-for-use-by-extensions.patch (application/octet-stream, 2.2K) download From 95f2103922a6df719123e49ec99deb454fb9d29e Mon Sep 17 00:00:00 2001 From: Thomas Munro <thomas.munro@enterprisedb.com> Date: Thu, 29 Mar 2018 13:28:52 +1300 Subject: [PATCH] Install errcodes.txt for use by extensions. Maintainers of out-of-tree PLs typically need access to the set of error codes. To avoid the need to duplicate that information in some form in PL source trees, provide errcodes.txt as part of a server installation. Author: Thomas Munro, based on a suggestion from Andrew Gierth Discussion: https://postgr.es/m/87woykk7mu.fsf%40news-spur.riddles.org.uk --- src/backend/Makefile | 2 ++ src/backend/utils/Makefile | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/backend/Makefile b/src/backend/Makefile index 21b094385f..a4b6d1658c 100644 --- a/src/backend/Makefile +++ b/src/backend/Makefile @@ -247,6 +247,7 @@ endif endif $(MAKE) -C catalog install-data $(MAKE) -C tsearch install-data + $(MAKE) -C utils install-data $(INSTALL_DATA) $(srcdir)/libpq/pg_hba.conf.sample '$(DESTDIR)$(datadir)/pg_hba.conf.sample' $(INSTALL_DATA) $(srcdir)/libpq/pg_ident.conf.sample '$(DESTDIR)$(datadir)/pg_ident.conf.sample' $(INSTALL_DATA) $(srcdir)/utils/misc/postgresql.conf.sample '$(DESTDIR)$(datadir)/postgresql.conf.sample' @@ -312,6 +313,7 @@ endif endif $(MAKE) -C catalog uninstall-data $(MAKE) -C tsearch uninstall-data + $(MAKE) -C utils uninstall-data rm -f '$(DESTDIR)$(datadir)/pg_hba.conf.sample' \ '$(DESTDIR)$(datadir)/pg_ident.conf.sample' \ '$(DESTDIR)$(datadir)/postgresql.conf.sample' \ diff --git a/src/backend/utils/Makefile b/src/backend/utils/Makefile index e296e6ce4d..163c81a1c2 100644 --- a/src/backend/utils/Makefile +++ b/src/backend/utils/Makefile @@ -46,6 +46,16 @@ else sed -f $(srcdir)/Gen_dummy_probes.sed $< >$@ endif +.PHONY: install-data +install-data: errcodes.txt installdirs + $(INSTALL_DATA) $(srcdir)/errcodes.txt '$(DESTDIR)$(datadir)/errcodes.txt' + +installdirs: + $(MKDIR_P) '$(DESTDIR)$(datadir)' + +.PHONY: uninstall-data +uninstall-data: + rm -f $(addprefix '$(DESTDIR)$(datadir)'/, errcodes.txt) # fmgroids.h, fmgrprotos.h, fmgrtab.c and errcodes.h are in the # distribution tarball, so they are not cleaned here. -- 2.16.2
^ permalink raw reply [nested|flat] 14+ messages in thread

* Re: Unrecognized exception condition "deprecated_feature"
  2018-03-09 18:55 Unrecognized exception condition "deprecated_feature" Kouber Saparev <kouber@gmail.com>
  2018-03-09 19:00 ` Re: Unrecognized exception condition "deprecated_feature" David G. Johnston <david.g.johnston@gmail.com>
  2018-03-09 22:44   ` Re: Unrecognized exception condition "deprecated_feature" Tom Lane <tgl@sss.pgh.pa.us>
  2018-03-10 00:17     ` Re: Unrecognized exception condition "deprecated_feature" Andres Freund <andres@anarazel.de>
  2018-03-10 00:42       ` Re: Unrecognized exception condition "deprecated_feature" Tom Lane <tgl@sss.pgh.pa.us>
  2018-03-10 02:12         ` Re: Unrecognized exception condition "deprecated_feature" Andrew Gierth <andrew@tao11.riddles.org.uk>
  2018-03-10 02:19           ` Re: Unrecognized exception condition "deprecated_feature" Andres Freund <andres@anarazel.de>
  2018-03-10 02:24             ` Re: Unrecognized exception condition "deprecated_feature" Alvaro Herrera <alvherre@alvh.no-ip.org>
  2018-03-29 00:41               ` Re: Unrecognized exception condition "deprecated_feature" Thomas Munro <thomas.munro@enterprisedb.com>
@ 2018-03-29 01:22                 ` Tom Lane <tgl@sss.pgh.pa.us>
  2018-03-29 01:46                   ` Re: Unrecognized exception condition "deprecated_feature" Thomas Munro <thomas.munro@enterprisedb.com>
  0 siblings, 1 reply; 14+ messages in thread

From: Tom Lane @ 2018-03-29 01:22 UTC (permalink / raw)
  To: Thomas Munro <thomas.munro@enterprisedb.com>; +Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>; Andres Freund <andres@anarazel.de>; Andrew Gierth <andrew@tao11.riddles.org.uk>; David G. Johnston <david.g.johnston@gmail.com>; Kouber Saparev <kouber@gmail.com>; pgsql-bugs

Thomas Munro <thomas.munro@enterprisedb.com> writes:
>>> While we're on the topic, I know of at least one other author of a
>>> non-core PL (besides myself) that has been frustrated by the fact that
>>> errcodes.txt is not installed anywhere, making it impossible to
>>> autogenerate a plerrcodes.h file in the extension build process.

> Something like this?  Or I guess src/backend/Makefile could do it directly.

Patch seems reasonable as far as it goes, but what about the MSVC
infrastructure?

Also, do we need to discuss exactly where it's being installed to?
Is the choice made here easy for an extension Makefile to locate?

			regards, tom lane




^ permalink  raw  reply  [nested|flat] 14+ messages in thread

* Re: Unrecognized exception condition "deprecated_feature"
  2018-03-09 18:55 Unrecognized exception condition "deprecated_feature" Kouber Saparev <kouber@gmail.com>
  2018-03-09 19:00 ` Re: Unrecognized exception condition "deprecated_feature" David G. Johnston <david.g.johnston@gmail.com>
  2018-03-09 22:44   ` Re: Unrecognized exception condition "deprecated_feature" Tom Lane <tgl@sss.pgh.pa.us>
  2018-03-10 00:17     ` Re: Unrecognized exception condition "deprecated_feature" Andres Freund <andres@anarazel.de>
  2018-03-10 00:42       ` Re: Unrecognized exception condition "deprecated_feature" Tom Lane <tgl@sss.pgh.pa.us>
  2018-03-10 02:12         ` Re: Unrecognized exception condition "deprecated_feature" Andrew Gierth <andrew@tao11.riddles.org.uk>
  2018-03-10 02:19           ` Re: Unrecognized exception condition "deprecated_feature" Andres Freund <andres@anarazel.de>
  2018-03-10 02:24             ` Re: Unrecognized exception condition "deprecated_feature" Alvaro Herrera <alvherre@alvh.no-ip.org>
  2018-03-29 00:41               ` Re: Unrecognized exception condition "deprecated_feature" Thomas Munro <thomas.munro@enterprisedb.com>
  2018-03-29 01:22                 ` Re: Unrecognized exception condition "deprecated_feature" Tom Lane <tgl@sss.pgh.pa.us>
@ 2018-03-29 01:46                   ` Thomas Munro <thomas.munro@enterprisedb.com>
  0 siblings, 0 replies; 14+ messages in thread

From: Thomas Munro @ 2018-03-29 01:46 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>; Andres Freund <andres@anarazel.de>; Andrew Gierth <andrew@tao11.riddles.org.uk>; David G. Johnston <david.g.johnston@gmail.com>; Kouber Saparev <kouber@gmail.com>; pgsql-bugs

On Thu, Mar 29, 2018 at 2:22 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Thomas Munro <thomas.munro@enterprisedb.com> writes:
>>>> While we're on the topic, I know of at least one other author of a
>>>> non-core PL (besides myself) that has been frustrated by the fact that
>>>> errcodes.txt is not installed anywhere, making it impossible to
>>>> autogenerate a plerrcodes.h file in the extension build process.
>
>> Something like this?  Or I guess src/backend/Makefile could do it directly.
>
> Patch seems reasonable as far as it goes, but what about the MSVC
> infrastructure?

Hmm.  Here is an untested version that makes Install.pm treat it the
same way as it treats sql_features.txt.  Does this look right?

> Also, do we need to discuss exactly where it's being installed to?
> Is the choice made here easy for an extension Makefile to locate?

${datadir} is:

  --datadir=DIR           read-only architecture-independent data [DATAROOTDIR]

The default comes from here:

  --datarootdir=DIR       read-only arch.-independent data root [PREFIX/share]

That is obtainable with pg_config --sharedir.  It's a bit obscure that
--sharedir means ${datadir}, but in my tree I see:

src/port/Makefile:      echo "#define PGSHAREDIR \"$(datadir)\"" >>$@

That makes its way into pg_config's clutches via this code:

src/port/path.c-get_share_path(const char *my_exec_path, char *ret_path)
src/port/path.c-{
src/port/path.c:        make_relative_path(ret_path, PGSHAREDIR,
PGBINDIR, my_exec_path);
src/port/path.c-}

So after "make install" I can find the file like this:

$ ls -slap $(pg_config --sharedir)/errcodes.txt
64 -rw-r--r--  1 munro  staff  31450 29 Mar 14:40
/Users/munro/install/postgres/share/errcodes.txt

Would there be a better location?

-- 
Thomas Munro
http://www.enterprisedb.com

Attachments:

0001-Install-errcodes.txt-for-use-by-extensions-v2.patch (application/octet-stream, 2.8K) download From bb6dcf562ea6d7e1c64f30b6e162423dc0314a6b Mon Sep 17 00:00:00 2001 From: Thomas Munro <thomas.munro@enterprisedb.com> Date: Thu, 29 Mar 2018 13:28:52 +1300 Subject: [PATCH] Install errcodes.txt for use by extensions. Maintainers of out-of-tree PLs typically need access to the set of error codes. To avoid the need to duplicate that information in some form in PL source trees, provide errcodes.txt as part of a server installation. Thomas Munro, based on a suggestion from Andrew Gierth Discussion: https://postgr.es/m/87woykk7mu.fsf%40news-spur.riddles.org.uk --- src/backend/Makefile | 2 ++ src/backend/utils/Makefile | 10 ++++++++++ src/tools/msvc/Install.pm | 3 +++ 3 files changed, 15 insertions(+) diff --git a/src/backend/Makefile b/src/backend/Makefile index 21b094385f..a4b6d1658c 100644 --- a/src/backend/Makefile +++ b/src/backend/Makefile @@ -247,6 +247,7 @@ endif endif $(MAKE) -C catalog install-data $(MAKE) -C tsearch install-data + $(MAKE) -C utils install-data $(INSTALL_DATA) $(srcdir)/libpq/pg_hba.conf.sample '$(DESTDIR)$(datadir)/pg_hba.conf.sample' $(INSTALL_DATA) $(srcdir)/libpq/pg_ident.conf.sample '$(DESTDIR)$(datadir)/pg_ident.conf.sample' $(INSTALL_DATA) $(srcdir)/utils/misc/postgresql.conf.sample '$(DESTDIR)$(datadir)/postgresql.conf.sample' @@ -312,6 +313,7 @@ endif endif $(MAKE) -C catalog uninstall-data $(MAKE) -C tsearch uninstall-data + $(MAKE) -C utils uninstall-data rm -f '$(DESTDIR)$(datadir)/pg_hba.conf.sample' \ '$(DESTDIR)$(datadir)/pg_ident.conf.sample' \ '$(DESTDIR)$(datadir)/postgresql.conf.sample' \ diff --git a/src/backend/utils/Makefile b/src/backend/utils/Makefile index e296e6ce4d..163c81a1c2 100644 --- a/src/backend/utils/Makefile +++ b/src/backend/utils/Makefile @@ -46,6 +46,16 @@ else sed -f $(srcdir)/Gen_dummy_probes.sed $< >$@ endif +.PHONY: install-data +install-data: errcodes.txt installdirs + $(INSTALL_DATA) $(srcdir)/errcodes.txt '$(DESTDIR)$(datadir)/errcodes.txt' + +installdirs: + $(MKDIR_P) '$(DESTDIR)$(datadir)' + +.PHONY: uninstall-data +uninstall-data: + rm -f $(addprefix '$(DESTDIR)$(datadir)'/, errcodes.txt) # fmgroids.h, fmgrprotos.h, fmgrtab.c and errcodes.h are in the # distribution tarball, so they are not cleaned here. diff --git a/src/tools/msvc/Install.pm b/src/tools/msvc/Install.pm index 8f3cc173c5..be67d8adbb 100644 --- a/src/tools/msvc/Install.pm +++ b/src/tools/msvc/Install.pm @@ -134,6 +134,9 @@ sub Install CopyFiles( 'Information schema data', $target . '/share/', 'src/backend/catalog/', 'sql_features.txt'); + CopyFiles( + 'Error code data', $target . '/share/', + 'src/backend/utils/', 'errcodes.txt'); GenerateConversionScript($target); GenerateTimezoneFiles($target, $conf); GenerateTsearchFiles($target); -- 2.16.2
^ permalink raw reply [nested|flat] 14+ messages in thread


end of thread, other threads:[~2018-03-29 01:46 UTC | newest]

Thread overview: 14+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-03-09 18:55 Unrecognized exception condition "deprecated_feature" Kouber Saparev <kouber@gmail.com>
2018-03-09 19:00 ` David G. Johnston <david.g.johnston@gmail.com>
2018-03-09 22:28   ` Kouber Saparev <kouber@gmail.com>
2018-03-09 22:44   ` Tom Lane <tgl@sss.pgh.pa.us>
2018-03-09 23:07     ` Kouber Saparev <kouber@gmail.com>
2018-03-10 00:17     ` Andres Freund <andres@anarazel.de>
2018-03-10 00:42       ` Tom Lane <tgl@sss.pgh.pa.us>
2018-03-10 00:55         ` Andres Freund <andres@anarazel.de>
2018-03-10 02:12         ` Andrew Gierth <andrew@tao11.riddles.org.uk>
2018-03-10 02:19           ` Andres Freund <andres@anarazel.de>
2018-03-10 02:24             ` Alvaro Herrera <alvherre@alvh.no-ip.org>
2018-03-29 00:41               ` Thomas Munro <thomas.munro@enterprisedb.com>
2018-03-29 01:22                 ` Tom Lane <tgl@sss.pgh.pa.us>
2018-03-29 01:46                   ` Thomas Munro <thomas.munro@enterprisedb.com>

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