agora inbox for pgsql-docs@postgresql.org  
help / color / mirror / Atom feed
From: Euler Taveira <euler@eulerto.com>
To: Yaroslav Saburov <y.saburov@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Peter Eisentraut <peter@eisentraut.org>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: pgsql-docs@lists.postgresql.org
Subject: Re: generated constraint name
Date: Fri, 11 Apr 2025 09:45:02 -0300
Message-ID: <944a4d69-0bd2-4eec-8886-554fd3f2fa09@app.fastmail.com> (raw)
In-Reply-To: <A76B1033-B4AE-4FE3-AC73-5B5303CF5071@gmail.com>
References: <520881.1744297980@sss.pgh.pa.us>
	<A76B1033-B4AE-4FE3-AC73-5B5303CF5071@gmail.com>

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


view thread (9+ messages)  latest in thread

Message-ID: <944a4d69-0bd2-4eec-8886-554fd3f2fa09@app.fastmail.com>
Permalink:  ../944a4d69-0bd2-4eec-8886-554fd3f2fa09@app.fastmail.com/
Also on:    postgresql.org/message-id/944a4d69-0bd2-4eec-8886-554fd3f2fa09@app.fastmail.com

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-docs@postgresql.org
  Cc: euler@eulerto.com, y.saburov@gmail.com, tgl@sss.pgh.pa.us, peter@eisentraut.org, david.g.johnston@gmail.com, pgsql-docs@lists.postgresql.org
  Subject: Re: generated constraint name
  In-Reply-To: <944a4d69-0bd2-4eec-8886-554fd3f2fa09@app.fastmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox