pg.ddx.io  pgsql-docs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Typo in "43.9.1. Reporting Errors and Messages"?
6+ messages / 5 participants
[nested] [flat]

* Typo in "43.9.1. Reporting Errors and Messages"?
@ 2022-07-31 23:37 PG Doc comments form <noreply@postgresql.org>
  2022-08-02 12:49 ` Re: Typo in "43.9.1. Reporting Errors and Messages"? Euler Taveira <euler@eulerto.com>
  0 siblings, 1 reply; 6+ messages in thread

From: PG Doc comments form @ 2022-07-31 23:37 UTC (permalink / raw)
  To: pgsql-docs@lists.postgresql.org; +Cc: eric.mutta@gmail.com

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/14/plpgsql-errors-and-messages.html
Description:

Towards the end of the "43.9.1. Reporting Errors and Messages" section (here
https://www.postgresql.org/docs/current/plpgsql-errors-and-messages.html#PLPGSQL-STATEMENTS-RAISE)
we have the following sentence:

> If no condition name nor SQLSTATE is specified in a RAISE EXCEPTION
command, the default is to use ERRCODE_RAISE_EXCEPTION (P0001).

Looking at the list of error codes (here
https://www.postgresql.org/docs/current/errcodes-appendix.html) I think the
"ERRCODE_RAISE_EXCEPTION (P0001)" is a typo and should remove "ERRCODE_" and
simply read "RAISE_EXCEPTION (P0001)" or perhaps "ERRCODE =
'RAISE_EXCEPTION'" since that's how the default behaviour would be written
in a RAISE statement.

Many thanks,
Eric Mutta.


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

* Re: Typo in "43.9.1. Reporting Errors and Messages"?
  2022-07-31 23:37 Typo in "43.9.1. Reporting Errors and Messages"? PG Doc comments form <noreply@postgresql.org>
@ 2022-08-02 12:49 ` Euler Taveira <euler@eulerto.com>
  2023-10-31 14:52   ` Re: Typo in "43.9.1. Reporting Errors and Messages"? Bruce Momjian <bruce@momjian.us>
  0 siblings, 1 reply; 6+ messages in thread

From: Euler Taveira @ 2022-08-02 12:49 UTC (permalink / raw)
  To: eric.mutta@gmail.com; pgsql-docs@lists.postgresql.org

On Sun, Jul 31, 2022, at 8:37 PM, PG Doc comments form wrote:
> Towards the end of the "43.9.1. Reporting Errors and Messages" section (here
> https://www.postgresql.org/docs/current/plpgsql-errors-and-messages.html#PLPGSQL-STATEMENTS-RAISE)
> we have the following sentence:
> 
> > If no condition name nor SQLSTATE is specified in a RAISE EXCEPTION
> command, the default is to use ERRCODE_RAISE_EXCEPTION (P0001).
> 
> Looking at the list of error codes (here
> https://www.postgresql.org/docs/current/errcodes-appendix.html) I think the
> "ERRCODE_RAISE_EXCEPTION (P0001)" is a typo and should remove "ERRCODE_" and
> simply read "RAISE_EXCEPTION (P0001)" or perhaps "ERRCODE =
> 'RAISE_EXCEPTION'" since that's how the default behaviour would be written
> in a RAISE statement.
It is referring to the internal constant (see src/backend/utils/errcodes.h). It
was like you are proposing and it was changed in
66bde49d96a9ddacc49dcbdf1b47b5bd6e31ead5. Reading the original thread, there is
no explanation why it was changed. Refer to internal names is not good for a
user-oriented text. I think it would be better to use the condition name (in
lowercase) like it is referred to in [1]. I mean, change
ERRCODE_RAISE_EXCEPTION to raise_exception.

[1] https://www.postgresql.org/docs/current/errcodes-appendix.html


--
Euler Taveira
EDB   https://www.enterprisedb.com/

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

* Re: Typo in "43.9.1. Reporting Errors and Messages"?
  2022-07-31 23:37 Typo in "43.9.1. Reporting Errors and Messages"? PG Doc comments form <noreply@postgresql.org>
  2022-08-02 12:49 ` Re: Typo in "43.9.1. Reporting Errors and Messages"? Euler Taveira <euler@eulerto.com>
@ 2023-10-31 14:52   ` Bruce Momjian <bruce@momjian.us>
  2023-10-31 18:00     ` Re: Typo in "43.9.1. Reporting Errors and Messages"? Alexander Lakhin <exclusion@gmail.com>
  0 siblings, 1 reply; 6+ messages in thread

From: Bruce Momjian @ 2023-10-31 14:52 UTC (permalink / raw)
  To: Euler Taveira <euler@eulerto.com>; +Cc: eric.mutta@gmail.com, pgsql-docs@lists.postgresql.org, Alexander Lakhin <exclusion@gmail.com>; Michael Paquier <michael@paquier.xyz>

On Tue, Aug  2, 2022 at 09:49:47AM -0300, Euler Taveira wrote:
> On Sun, Jul 31, 2022, at 8:37 PM, PG Doc comments form wrote:
> 
>     Towards the end of the "43.9.1. Reporting Errors and Messages" section
>     (here
>     https://www.postgresql.org/docs/current/plpgsql-errors-and-messages.html#
>     PLPGSQL-STATEMENTS-RAISE)
>     we have the following sentence:
> 
>     > If no condition name nor SQLSTATE is specified in a RAISE EXCEPTION
>     command, the default is to use ERRCODE_RAISE_EXCEPTION (P0001).
> 
>     Looking at the list of error codes (here
>     https://www.postgresql.org/docs/current/errcodes-appendix.html) I think the
>     "ERRCODE_RAISE_EXCEPTION (P0001)" is a typo and should remove "ERRCODE_"
>     and
>     simply read "RAISE_EXCEPTION (P0001)" or perhaps "ERRCODE =
>     'RAISE_EXCEPTION'" since that's how the default behaviour would be written
>     in a RAISE statement.
> 
> It is referring to the internal constant (see src/backend/utils/errcodes.h). It
> was like you are proposing and it was changed in
> 66bde49d96a9ddacc49dcbdf1b47b5bd6e31ead5. Reading the original thread, there is
> no explanation why it was changed. Refer to internal names is not good for a
> user-oriented text. I think it would be better to use the condition name (in
> lowercase) like it is referred to in [1]. I mean, change
> ERRCODE_RAISE_EXCEPTION to raise_exception.
> 
> [1] https://www.postgresql.org/docs/current/errcodes-appendix.html

Alexander, Michael, can you explain why this commit removed ERRCODE_:

	commit 66bde49d96
	Author: Michael Paquier <michael@paquier.xyz>
	Date:   Tue Aug 13 13:53:41 2019 +0900
	
	    Fix inconsistencies and typos in the tree, take 10
	
	    This addresses some issues with unnecessary code comments, fixes various
	    typos in docs and comments, and removes some orphaned structures and
	    definitions.
	
	    Author: Alexander Lakhin
	    Discussion: https://postgr.es/m/9aabc775-5494-b372-8bcb-4dfc0bd37c68@gmail.com


-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  Only you can decide what is important to you.





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

* Re: Typo in "43.9.1. Reporting Errors and Messages"?
  2022-07-31 23:37 Typo in "43.9.1. Reporting Errors and Messages"? PG Doc comments form <noreply@postgresql.org>
  2022-08-02 12:49 ` Re: Typo in "43.9.1. Reporting Errors and Messages"? Euler Taveira <euler@eulerto.com>
  2023-10-31 14:52   ` Re: Typo in "43.9.1. Reporting Errors and Messages"? Bruce Momjian <bruce@momjian.us>
@ 2023-10-31 18:00     ` Alexander Lakhin <exclusion@gmail.com>
  2023-11-01 00:18       ` Re: Typo in "43.9.1. Reporting Errors and Messages"? Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 6+ messages in thread

From: Alexander Lakhin @ 2023-10-31 18:00 UTC (permalink / raw)
  To: Bruce Momjian <bruce@momjian.us>; Euler Taveira <euler@eulerto.com>; +Cc: eric.mutta@gmail.com, pgsql-docs@lists.postgresql.org, Michael Paquier <michael@paquier.xyz>

Hi Bruce,

31.10.2023 17:52, Bruce Momjian wrote:
>
>> It is referring to the internal constant (see src/backend/utils/errcodes.h). It
>> was like you are proposing and it was changed in
>> 66bde49d96a9ddacc49dcbdf1b47b5bd6e31ead5. Reading the original thread, there is
>> no explanation why it was changed. Refer to internal names is not good for a
>> user-oriented text. I think it would be better to use the condition name (in
>> lowercase) like it is referred to in [1]. I mean, change
>> ERRCODE_RAISE_EXCEPTION to raise_exception.
>>
>> [1] https://www.postgresql.org/docs/current/errcodes-appendix.html
> Alexander, Michael, can you explain why this commit removed ERRCODE_:
>
> 	commit 66bde49d96

I don't remember details, but I think the primary reason for the change
was that "RAISE_EXCEPTION" occurred in the whole tree only once (before
66bde49d96). Now I see, that I had chosen the wrong replacement — I agree
with Euler, change to "raise_exception" would be more appropriate.

(I've found a similar mention of ERRCODE_xxx in btree.sgml:
   Before doing so, the function should check the sign
   of <replaceable>offset</replaceable>: if it is less than zero, raise
   error <literal>ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE</literal> (22013)
   with error text like <quote>invalid preceding or following size in window
   function</quote>.
but I think that's okay here, because that identifier supposed to be used
as-is in ereport/elog.)

Best regards,
Alexander





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

* Re: Typo in "43.9.1. Reporting Errors and Messages"?
  2022-07-31 23:37 Typo in "43.9.1. Reporting Errors and Messages"? PG Doc comments form <noreply@postgresql.org>
  2022-08-02 12:49 ` Re: Typo in "43.9.1. Reporting Errors and Messages"? Euler Taveira <euler@eulerto.com>
  2023-10-31 14:52   ` Re: Typo in "43.9.1. Reporting Errors and Messages"? Bruce Momjian <bruce@momjian.us>
  2023-10-31 18:00     ` Re: Typo in "43.9.1. Reporting Errors and Messages"? Alexander Lakhin <exclusion@gmail.com>
@ 2023-11-01 00:18       ` Michael Paquier <michael@paquier.xyz>
  2023-11-01 22:35         ` Re: Typo in "43.9.1. Reporting Errors and Messages"? Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 6+ messages in thread

From: Michael Paquier @ 2023-11-01 00:18 UTC (permalink / raw)
  To: Alexander Lakhin <exclusion@gmail.com>; +Cc: Bruce Momjian <bruce@momjian.us>; Euler Taveira <euler@eulerto.com>; eric.mutta@gmail.com; pgsql-docs@lists.postgresql.org

On Tue, Oct 31, 2023 at 09:00:00PM +0300, Alexander Lakhin wrote:
> I don't remember details, but I think the primary reason for the change
> was that "RAISE_EXCEPTION" occurred in the whole tree only once (before
> 66bde49d96). Now I see, that I had chosen the wrong replacement — I agree
> with Euler, change to "raise_exception" would be more appropriate.

Indeed, it looks like the origin of the confusion is the casing here,
so changing to "raise_exception" like in the appendix sounds good to
me:
https://www.postgresql.org/docs/devel/errcodes-appendix.html

So you mean something like the attached then?

> (I've found a similar mention of ERRCODE_xxx in btree.sgml:
>   Before doing so, the function should check the sign
>   of <replaceable>offset</replaceable>: if it is less than zero, raise
>   error <literal>ERRCODE_INVALID_PRECEDING_OR_FOLLOWING_SIZE</literal> (22013)
>   with error text like <quote>invalid preceding or following size in window
>   function</quote>.
> but I think that's okay here, because that identifier supposed to be used
> as-is in ereport/elog.)

Yep, still this one is not that old (0a459cec96d3).
--
Michael

Attachments:

  [text/x-diff] plpg-errcode-doc.patch (669B, ../../ZUGZZ-J_AeeWM4_o@paquier.xyz/2-plpg-errcode-doc.patch)
  download | inline diff:
diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index 83f867f91d..5977534a62 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -3942,7 +3942,7 @@ RAISE unique_violation USING MESSAGE = 'Duplicate user ID: ' || user_id;
    <para>
     If no condition name nor SQLSTATE is specified in a
     <command>RAISE EXCEPTION</command> command, the default is to use
-    <literal>ERRCODE_RAISE_EXCEPTION</literal> (<literal>P0001</literal>).
+    <literal>raise_exception</literal> (<literal>P0001</literal>).
     If no message text is specified, the default is to use the condition
     name or SQLSTATE as message text.
    </para>

  [application/pgp-signature] signature.asc (832B, ../../ZUGZZ-J_AeeWM4_o@paquier.xyz/3-signature.asc)
  download

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

* Re: Typo in "43.9.1. Reporting Errors and Messages"?
  2022-07-31 23:37 Typo in "43.9.1. Reporting Errors and Messages"? PG Doc comments form <noreply@postgresql.org>
  2022-08-02 12:49 ` Re: Typo in "43.9.1. Reporting Errors and Messages"? Euler Taveira <euler@eulerto.com>
  2023-10-31 14:52   ` Re: Typo in "43.9.1. Reporting Errors and Messages"? Bruce Momjian <bruce@momjian.us>
  2023-10-31 18:00     ` Re: Typo in "43.9.1. Reporting Errors and Messages"? Alexander Lakhin <exclusion@gmail.com>
  2023-11-01 00:18       ` Re: Typo in "43.9.1. Reporting Errors and Messages"? Michael Paquier <michael@paquier.xyz>
@ 2023-11-01 22:35         ` Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2023-11-01 22:35 UTC (permalink / raw)
  To: Alexander Lakhin <exclusion@gmail.com>; +Cc: Bruce Momjian <bruce@momjian.us>; Euler Taveira <euler@eulerto.com>; eric.mutta@gmail.com; pgsql-docs@lists.postgresql.org

On Wed, Nov 01, 2023 at 09:18:47AM +0900, Michael Paquier wrote:
> So you mean something like the attached then?

Fixed that with f8b96c211da0 down to 11, in time for next week's
release set.
--
Michael

Attachments:

  [application/pgp-signature] signature.asc (832B, ../../ZULSqmo9yh72rrrw@paquier.xyz/2-signature.asc)
  download

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


end of thread, other threads:[~2023-11-01 22:35 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-07-31 23:37 Typo in "43.9.1. Reporting Errors and Messages"? PG Doc comments form <noreply@postgresql.org>
2022-08-02 12:49 ` Euler Taveira <euler@eulerto.com>
2023-10-31 14:52   ` Bruce Momjian <bruce@momjian.us>
2023-10-31 18:00     ` Alexander Lakhin <exclusion@gmail.com>
2023-11-01 00:18       ` Michael Paquier <michael@paquier.xyz>
2023-11-01 22:35         ` Michael Paquier <michael@paquier.xyz>

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