agora inbox for pgsql-docs@postgresql.org
help / color / mirror / Atom feedgenerated constraint name
9+ messages / 7 participants
[nested] [flat]
* generated constraint name
@ 2025-04-06 10:16 PG Doc comments form <noreply@postgresql.org>
0 siblings, 1 reply; 9+ messages in thread
From: PG Doc comments form @ 2025-04-06 10:16 UTC (permalink / raw)
To: pgsql-docs@lists.postgresql.org; +Cc: y.saburov@gmail.com
The following documentation comment has been logged on the website:
Page: https://www.postgresql.org/docs/17/ddl-alter.html
Description:
url:
https://www.postgresql.org/docs/current/ddl-alter.html#DDL-ALTER-REMOVING-A-CONSTRAINT
(If you are dealing with a generated constraint name like $2, don't forget
that you'll need to double-quote it to make it a valid identifier.)
If I have a constraint with the name $2, are there other constraints with
names $1, $3 ... ?
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: generated constraint name
@ 2025-04-07 13:34 David G. Johnston <david.g.johnston@gmail.com>
parent: PG Doc comments form <noreply@postgresql.org>
0 siblings, 2 replies; 9+ messages in thread
From: David G. Johnston @ 2025-04-07 13:34 UTC (permalink / raw)
To: y.saburov@gmail.com <y.saburov@gmail.com>; pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>
On Sunday, April 6, 2025, PG Doc comments form <noreply@postgresql.org>
wrote:
> The following documentation comment has been logged on the website:
>
> Page: https://www.postgresql.org/docs/17/ddl-alter.html
> Description:
>
> url:
> https://www.postgresql.org/docs/current/ddl-alter.html#
> DDL-ALTER-REMOVING-A-CONSTRAINT
>
> (If you are dealing with a generated constraint name like $2, don't forget
> that you'll need to double-quote it to make it a valid identifier.)
>
> If I have a constraint with the name $2, are there other constraints with
> names $1, $3 ... ?
>
I feel like that whole parenthetical should just go away. The point of the
comment is to remind the user of how identifier values work with respect to
mandatory double quoting. The name itself, other than having a $, has no
special importance.
David J.
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: generated constraint name
@ 2025-04-08 06:10 Yaroslav Saburov <y.saburov@gmail.com>
parent: David G. Johnston <david.g.johnston@gmail.com>
1 sibling, 0 replies; 9+ messages in thread
From: Yaroslav Saburov @ 2025-04-08 06:10 UTC (permalink / raw)
To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: pgsql-docs@lists.postgresql.org
You do not provide the output of the table description, but write that the system generated the name $2
> 7 квіт. 2025 р. о 16:34 David G. Johnston <david.g.johnston@gmail.com> пише:
>
> On Sunday, April 6, 2025, PG Doc comments form <noreply@postgresql.org> wrote:
>> The following documentation comment has been logged on the website:
>>
>> Page: https://www.postgresql.org/docs/17/ddl-alter.html
>> Description:
>>
>> url:
>> https://www.postgresql.org/docs/current/ddl-alter.html#DDL-ALTER-REMOVING-A-CONSTRAINT
>>
>> (If you are dealing with a generated constraint name like $2, don't forget
>> that you'll need to double-quote it to make it a valid identifier.)
>>
>> If I have a constraint with the name $2, are there other constraints with
>> names $1, $3 ... ?
>
> I feel like that whole parenthetical should just go away. The point of the comment is to remind the user of how identifier values work with respect to mandatory double quoting. The name itself, other than having a $, has no special importance.
>
> David J.
>
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: generated constraint name
@ 2025-04-10 14:11 Peter Eisentraut <peter@eisentraut.org>
parent: David G. Johnston <david.g.johnston@gmail.com>
1 sibling, 1 reply; 9+ messages in thread
From: Peter Eisentraut @ 2025-04-10 14:11 UTC (permalink / raw)
To: David G. Johnston <david.g.johnston@gmail.com>; y.saburov@gmail.com <y.saburov@gmail.com>; pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>
On 07.04.25 15:34, David G. Johnston wrote:
> On Sunday, April 6, 2025, PG Doc comments form <noreply@postgresql.org
> <mailto:noreply@postgresql.org>> wrote:
>
> The following documentation comment has been logged on the website:
>
> Page: https://www.postgresql.org/docs/17/ddl-alter.html <https://
> www.postgresql.org/docs/17/ddl-alter.html>
> Description:
>
> url:
> https://www.postgresql.org/docs/current/ddl-alter.html#DDL-ALTER-
> REMOVING-A-CONSTRAINT <https://www.postgresql.org/docs/current/ddl-
> alter.html#DDL-ALTER-REMOVING-A-CONSTRAINT>
>
> (If you are dealing with a generated constraint name like $2, don't
> forget
> that you'll need to double-quote it to make it a valid identifier.)
>
> If I have a constraint with the name $2, are there other constraints
> with
> names $1, $3 ... ?
>
>
> I feel like that whole parenthetical should just go away. The point of
> the comment is to remind the user of how identifier values work with
> respect to mandatory double quoting. The name itself, other than having
> a $, has no special importance.
I think generated constraint names were generally "$1", "$2", etc. at
some point, instead of the more readable ones you get today. But this
must be ancient.
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: generated constraint name
@ 2025-04-10 15:13 Tom Lane <tgl@sss.pgh.pa.us>
parent: Peter Eisentraut <peter@eisentraut.org>
0 siblings, 1 reply; 9+ messages in thread
From: Tom Lane @ 2025-04-10 15:13 UTC (permalink / raw)
To: Peter Eisentraut <peter@eisentraut.org>; +Cc: David G. Johnston <david.g.johnston@gmail.com>; y.saburov@gmail.com <y.saburov@gmail.com>; pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>
Peter Eisentraut <peter@eisentraut.org> writes:
> On 07.04.25 15:34, David G. Johnston wrote:
>> I feel like that whole parenthetical should just go away. The point of
>> the comment is to remind the user of how identifier values work with
>> respect to mandatory double quoting. The name itself, other than having
>> a $, has no special importance.
> I think generated constraint names were generally "$1", "$2", etc. at
> some point, instead of the more readable ones you get today. But this
> must be ancient.
Good point. A bit of git-blame'ing shows that this documentation
wording appeared in e560dd353 of 2003-11-05, but we changed the
generation rule to not be "$n" in 45616f5bb of 2004-06-10.
(Oddly, I moved this documentation text around in 2005 without
noticing it was obsolete; or perhaps I did realize that but figured
it was still applicable to versions in the field.)
I concur with David that we should just drop the para. It's merely
confusing now. If you have a generated constraint name, it won't
require double-quoting unless your table or column name does, and
if they do you are doubtless already quite familiar with how
quoting works.
regards, tom lane
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: generated constraint name
@ 2025-04-11 08:32 Yaroslav Saburov <y.saburov@gmail.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 9+ messages in thread
From: Yaroslav Saburov @ 2025-04-11 08:32 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Peter Eisentraut <peter@eisentraut.org>; David G. Johnston <david.g.johnston@gmail.com>; pgsql-docs@lists.postgresql.org
Thank you all.
In order not to open a new thread, (small clarification)
On the tutorial-agg page in the code example
SELECT city FROM weather WHERE temp_lo = max(temp_lo); WRONG
you need to add a comment before WRONG
> 10 квіт. 2025 р. о 18:13 Tom Lane <tgl@sss.pgh.pa.us> пише:
>
> Peter Eisentraut <peter@eisentraut.org> writes:
>>> On 07.04.25 15:34, David G. Johnston wrote:
>>> I feel like that whole parenthetical should just go away. The point of
>>> the comment is to remind the user of how identifier values work with
>>> respect to mandatory double quoting. The name itself, other than having
>>> a $, has no special importance.
>
>> I think generated constraint names were generally "$1", "$2", etc. at
>> some point, instead of the more readable ones you get today. But this
>> must be ancient.
>
> Good point. A bit of git-blame'ing shows that this documentation
> wording appeared in e560dd353 of 2003-11-05, but we changed the
> generation rule to not be "$n" in 45616f5bb of 2004-06-10.
> (Oddly, I moved this documentation text around in 2005 without
> noticing it was obsolete; or perhaps I did realize that but figured
> it was still applicable to versions in the field.)
>
> I concur with David that we should just drop the para. It's merely
> confusing now. If you have a generated constraint name, it won't
> require double-quoting unless your table or column name does, and
> if they do you are doubtless already quite familiar with how
> quoting works.
>
> regards, tom lane
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: generated constraint name
@ 2025-04-11 12:45 Euler Taveira <euler@eulerto.com>
parent: Yaroslav Saburov <y.saburov@gmail.com>
0 siblings, 1 reply; 9+ messages in thread
From: Euler Taveira @ 2025-04-11 12:45 UTC (permalink / raw)
To: Yaroslav Saburov <y.saburov@gmail.com>; Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Peter Eisentraut <peter@eisentraut.org>; David G. Johnston <david.g.johnston@gmail.com>; pgsql-docs@lists.postgresql.org
On Fri, Apr 11, 2025, at 5:32 AM, Yaroslav Saburov wrote:
>
> Thank you all.
>
>
>
> In order not to open a new thread, (small clarification)
>
Don't be afraid to open a new thread. Indeed, a new topic (even if it is
minimal) deserves a new thread.
> On the tutorial-agg page in the code example
>
>
>
> SELECT city FROM weather WHERE temp_lo = max(temp_lo); WRONG
>
>
>
> you need to add a comment before WRONG
>
If you consider that that query is correct and it fails in the "wrong" then you
made the point.
postgres-# select 1; wrong
ERROR: syntax error at or near "WRONG"
LINE 1: WRONG
^
However, the query is not correct and it fails before processing the second
statement (wrong) so it doesn't matter much in this case. Even after saying
that, I agree with you that this annotation without the comment characters
don't make much sense.
postgres=# SELECT city FROM weather WHERE temp_lo = max(temp_lo); WRONG
ERROR: aggregate functions are not allowed in WHERE
LINE 1: SELECT city FROM weather WHERE temp_lo = max(temp_lo);
^
--
Euler Taveira
EDB https://www.enterprisedb.com/
Attachments:
[text/x-patch] tutorial.patch (524B, ../../944a4d69-0bd2-4eec-8886-554fd3f2fa09@app.fastmail.com/3-tutorial.patch)
download | inline diff:
diff --git a/doc/src/sgml/query.sgml b/doc/src/sgml/query.sgml
index 59962d6e856..727a0cb185f 100644
--- a/doc/src/sgml/query.sgml
+++ b/doc/src/sgml/query.sgml
@@ -671,7 +671,7 @@ SELECT max(temp_lo) FROM weather;
we might try:
<programlisting>
-SELECT city FROM weather WHERE temp_lo = max(temp_lo); <lineannotation>WRONG</lineannotation>
+SELECT city FROM weather WHERE temp_lo = max(temp_lo); <lineannotation>-- WRONG</lineannotation>
</programlisting>
but this will not work since the aggregate
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: generated constraint name
@ 2025-04-24 15:13 Robert Treat <rob@xzilla.net>
parent: Euler Taveira <euler@eulerto.com>
0 siblings, 1 reply; 9+ messages in thread
From: Robert Treat @ 2025-04-24 15:13 UTC (permalink / raw)
To: Euler Taveira <euler@eulerto.com>; +Cc: Yaroslav Saburov <y.saburov@gmail.com>; Tom Lane <tgl@sss.pgh.pa.us>; Peter Eisentraut <peter@eisentraut.org>; David G. Johnston <david.g.johnston@gmail.com>; pgsql-docs@lists.postgresql.org
On Fri, Apr 11, 2025 at 8:45 AM Euler Taveira <euler@eulerto.com> wrote:
> On Fri, Apr 11, 2025, at 5:32 AM, Yaroslav Saburov wrote:
> On the tutorial-agg page in the code example
>
> SELECT city FROM weather WHERE temp_lo = max(temp_lo); WRONG
>
> you need to add a comment before WRONG
>
> If you consider that that query is correct and it fails in the "wrong" then you
> made the point.
>
> postgres-# select 1; wrong
> ERROR: syntax error at or near "WRONG"
> LINE 1: WRONG
> ^
>
> However, the query is not correct and it fails before processing the second
> statement (wrong) so it doesn't matter much in this case. Even after saying
> that, I agree with you that this annotation without the comment characters
> don't make much sense.
>
> postgres=# SELECT city FROM weather WHERE temp_lo = max(temp_lo); WRONG
> ERROR: aggregate functions are not allowed in WHERE
> LINE 1: SELECT city FROM weather WHERE temp_lo = max(temp_lo);
> ^
While this was a small change, I do think it was an improvement, so
bumping Euler's suggested patch as I think it got lost in the other
discussion.
Robert Treat
https://xzilla.net
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: generated constraint name
@ 2025-04-29 12:44 Peter Eisentraut <peter@eisentraut.org>
parent: Robert Treat <rob@xzilla.net>
0 siblings, 0 replies; 9+ messages in thread
From: Peter Eisentraut @ 2025-04-29 12:44 UTC (permalink / raw)
To: Robert Treat <rob@xzilla.net>; Euler Taveira <euler@eulerto.com>; +Cc: Yaroslav Saburov <y.saburov@gmail.com>; Tom Lane <tgl@sss.pgh.pa.us>; David G. Johnston <david.g.johnston@gmail.com>; pgsql-docs@lists.postgresql.org
On 24.04.25 17:13, Robert Treat wrote:
> On Fri, Apr 11, 2025 at 8:45 AM Euler Taveira <euler@eulerto.com> wrote:
>> On Fri, Apr 11, 2025, at 5:32 AM, Yaroslav Saburov wrote:
>> On the tutorial-agg page in the code example
>>
>> SELECT city FROM weather WHERE temp_lo = max(temp_lo); WRONG
>>
>> you need to add a comment before WRONG
>>
>> If you consider that that query is correct and it fails in the "wrong" then you
>> made the point.
>>
>> postgres-# select 1; wrong
>> ERROR: syntax error at or near "WRONG"
>> LINE 1: WRONG
>> ^
>>
>> However, the query is not correct and it fails before processing the second
>> statement (wrong) so it doesn't matter much in this case. Even after saying
>> that, I agree with you that this annotation without the comment characters
>> don't make much sense.
>>
>> postgres=# SELECT city FROM weather WHERE temp_lo = max(temp_lo); WRONG
>> ERROR: aggregate functions are not allowed in WHERE
>> LINE 1: SELECT city FROM weather WHERE temp_lo = max(temp_lo);
>> ^
>
> While this was a small change, I do think it was an improvement, so
> bumping Euler's suggested patch as I think it got lost in the other
> discussion.
Committed. Thanks for the reminder/review.
^ permalink raw reply [nested|flat] 9+ messages in thread
end of thread, other threads:[~2025-04-29 12:44 UTC | newest]
Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-04-06 10:16 generated constraint name PG Doc comments form <noreply@postgresql.org>
2025-04-07 13:34 ` David G. Johnston <david.g.johnston@gmail.com>
2025-04-08 06:10 ` Yaroslav Saburov <y.saburov@gmail.com>
2025-04-10 14:11 ` Peter Eisentraut <peter@eisentraut.org>
2025-04-10 15:13 ` Tom Lane <tgl@sss.pgh.pa.us>
2025-04-11 08:32 ` Yaroslav Saburov <y.saburov@gmail.com>
2025-04-11 12:45 ` Euler Taveira <euler@eulerto.com>
2025-04-24 15:13 ` Robert Treat <rob@xzilla.net>
2025-04-29 12:44 ` Peter Eisentraut <peter@eisentraut.org>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox