pg.ddx.io pgsql-docs@postgresql.org mailing list archive
help / color / mirror / Atom feedwrong field in example
7+ messages / 5 participants
[nested] [flat]
* wrong field in example
@ 2024-07-24 06:05 PG Doc comments form <noreply@postgresql.org>
0 siblings, 1 reply; 7+ messages in thread
From: PG Doc comments form @ 2024-07-24 06:05 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/16/queries-table-expressions.html
Description:
>> In the second query, we could not have written SELECT * FROM test1 GROUP
BY x, because there is no single value for the column y that could be
associated with each group. The grouped-by columns can be referenced in the
select list since they have a single value in each group.
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: wrong field in example
@ 2024-07-24 12:57 David G. Johnston <david.g.johnston@gmail.com>
parent: PG Doc comments form <noreply@postgresql.org>
0 siblings, 1 reply; 7+ messages in thread
From: David G. Johnston @ 2024-07-24 12:57 UTC (permalink / raw)
To: y.saburov@gmail.com <y.saburov@gmail.com>; pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>
On Tuesday, July 23, 2024, PG Doc comments form <noreply@postgresql.org>
wrote:
> The following documentation comment has been logged on the website:
>
> Page: https://www.postgresql.org/docs/16/queries-table-expressions.html
> Description:
>
> >> In the second query, we could not have written SELECT * FROM test1 GROUP
> BY x, because there is no single value for the column y that could be
> associated with each group. The grouped-by columns can be referenced in the
> select list since they have a single value in each group.
>
I think you mis-copied the query - the one on the page has “select x”, not
“select *”.
David J.
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: wrong field in example
@ 2024-07-24 13:09 David Rowley <dgrowleyml@gmail.com>
parent: David G. Johnston <david.g.johnston@gmail.com>
0 siblings, 1 reply; 7+ messages in thread
From: David Rowley @ 2024-07-24 13:09 UTC (permalink / raw)
To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: y.saburov@gmail.com; pgsql-docs@lists.postgresql.org
On Thu, 25 Jul 2024, 12:57 am David G. Johnston, <david.g.johnston@gmail.com>
wrote:
> I think you mis-copied the query - the one on the page has “select x”, not
> “select *”.
>
That text exists as it was quoted. What the report is lacking is an
indication of what is wrong with the text.
David
>
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: wrong field in example
@ 2024-07-24 13:51 David G. Johnston <david.g.johnston@gmail.com>
parent: David Rowley <dgrowleyml@gmail.com>
0 siblings, 0 replies; 7+ messages in thread
From: David G. Johnston @ 2024-07-24 13:51 UTC (permalink / raw)
To: David Rowley <dgrowleyml@gmail.com>; +Cc: y.saburov@gmail.com <y.saburov@gmail.com>; pgsql-docs@lists.postgresql.org <pgsql-docs@lists.postgresql.org>
On Wednesday, July 24, 2024, David Rowley <dgrowleyml@gmail.com> wrote:
> On Thu, 25 Jul 2024, 12:57 am David G. Johnston, <
> david.g.johnston@gmail.com> wrote:
>
>> I think you mis-copied the query - the one on the page has “select x”,
>> not “select *”.
>>
>
> That text exists as it was quoted. What the report is lacking is an
> indication of what is wrong with the text.
>
Ok, I was just looking at the examples, thinking the report indicated a
broken example. I agree nothing seems wrong with the text and the report
has zero comment.
David J.
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: wrong field in example
@ 2024-07-24 16:04 David G. Johnston <david.g.johnston@gmail.com>
0 siblings, 1 reply; 7+ messages in thread
From: David G. Johnston @ 2024-07-24 16:04 UTC (permalink / raw)
To: Yaroslav Saburov <y.saburov@gmail.com>; PostgreSQL Documentation <pgsql-docs@lists.postgresql.org>
Just noticed you replied to me only. Send replies to the list. You can
leave individuals cc'd. The convention here is also to inline your replies
- top-posting is undesirable.
In any case, in order to write "select *" you have to group on both x and y
at the same time. If you group on either column only, the query will
fail. So the choice of x versus y is immaterial. Having grouped on x the
text is explaining that the failure to also group on y is a problem.
I don't know that the existing wording is the most clear, but it is correct.
David J.
On Wed, Jul 24, 2024 at 8:02 AM Yaroslav Saburov <y.saburov@gmail.com>
wrote:
> >>because there is no single value for the column y that could be
> associated with each group.
>
> 24 лип. 2024 р. о 17:51 David G. Johnston <david.g.johnston@gmail.com>
> пише:
>
>
>
>
> On Wed, Jul 24, 2024, 07:45 Yaroslav Saburov <y.saburov@gmail.com> wrote:
>
>> group by y, not by x
>>
>> Why?
>
> David J.
>
>>
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: wrong field in example
@ 2024-07-24 16:17 Tom Lane <tgl@sss.pgh.pa.us>
parent: David G. Johnston <david.g.johnston@gmail.com>
0 siblings, 1 reply; 7+ messages in thread
From: Tom Lane @ 2024-07-24 16:17 UTC (permalink / raw)
To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: Yaroslav Saburov <y.saburov@gmail.com>; PostgreSQL Documentation <pgsql-docs@lists.postgresql.org>
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> I don't know that the existing wording is the most clear, but it is correct.
Perhaps it'd be better to write "... we could not have written
SELECT x, y FROM test1 GROUP BY x, because ..." ? The first
half of the example uses "SELECT *", and this bit was meant
to be consistent with that; but if the reader is confused about
how "y" got into the discussion then writing it out explicitly
should help.
regards, tom lane
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: wrong field in example
@ 2024-07-24 16:31 Yaroslav Saburov <y.saburov@gmail.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 7+ messages in thread
From: Yaroslav Saburov @ 2024-07-24 16:31 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: David G. Johnston <david.g.johnston@gmail.com>; PostgreSQL Documentation <pgsql-docs@lists.postgresql.org>
first query
=> SELECT * FROM test1;
x | y
---+---
a | 3
c | 2
b | 5
a | 1
(4 rows)
second query
=> SELECT x FROM test1 GROUP BY x;
x
---
a
b
c
(3 rows)
In the second query, we could not have written SELECT * FROM test1 GROUP BY x, because there is no single value for the column y that could be associated with each group. The grouped-by columns can be referenced in the select list since they have a single value in each group.
> 24 лип. 2024 р. о 19:17 Tom Lane <tgl@sss.pgh.pa.us> пише:
>
> "David G. Johnston" <david.g.johnston@gmail.com> writes:
>> I don't know that the existing wording is the most clear, but it is correct.
>
> Perhaps it'd be better to write "... we could not have written
> SELECT x, y FROM test1 GROUP BY x, because ..." ? The first
> half of the example uses "SELECT *", and this bit was meant
> to be consistent with that; but if the reader is confused about
> how "y" got into the discussion then writing it out explicitly
> should help.
>
> regards, tom lane
^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2024-07-24 16:31 UTC | newest]
Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2024-07-24 06:05 wrong field in example PG Doc comments form <noreply@postgresql.org>
2024-07-24 12:57 ` David G. Johnston <david.g.johnston@gmail.com>
2024-07-24 13:09 ` David Rowley <dgrowleyml@gmail.com>
2024-07-24 13:51 ` David G. Johnston <david.g.johnston@gmail.com>
2024-07-24 16:04 Re: wrong field in example David G. Johnston <david.g.johnston@gmail.com>
2024-07-24 16:17 ` Tom Lane <tgl@sss.pgh.pa.us>
2024-07-24 16:31 ` Yaroslav Saburov <y.saburov@gmail.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