Re: generated constraint name

Robert Treat <rob@xzilla.net>

From: Robert Treat <rob@xzilla.net>
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
Date: 2025-04-24T15:13:24Z
Lists: pgsql-docs
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



Commits

  1. doc: Small example improvement

  2. Doc: remove long-obsolete advice about generated constraint names.