Re: group by true now errors with non-integer constant in GROUP BY

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Rowley <dgrowleyml(at)gmail(dot)com>
Cc: John Naylor <john(dot)naylor(at)enterprisedb(dot)com>, David Micallef <david(dot)j(dot)micallef(at)gmail(dot)com>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: group by true now errors with non-integer constant in GROUP BY
Date: 2023-09-18 00:00:55
Message-ID: 4153025.1694995255@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

David Rowley <dgrowleyml(at)gmail(dot)com> writes:
> 2. In master only, remove the special case added in #1 and allow any
> non-integer constants to be treated as expressions.

> I think #2 is a good move for the following reasons:

FTR, I still think this is a bad idea. It will add more confusion
than it removes, and I don't buy that it will confer any advantages,
because nobody asked for it previously.

However, assuming that I'm going to be out-voted: your docs changes
still need work. That phrasing makes it sound like an output column
name could be "expressed as an integer literal". Maybe we should
restructure the whole sentence, perhaps along the lines of

... class="parameter">expression</replaceable> used inside a
<replaceable class="parameter">grouping_element</replaceable>
can be an input column name or an arbitrary expression formed
from input column values. For backwards compatibility with
SQL-92, the <replaceable>expression</replaceable> can also be
an output column name or an integer literal representing the
ordinal number of an output column. In case of ambiguity, a
<literal>GROUP BY</literal> item that is just a name will be
interpreted as an input column name rather than an output column
name.

Neither formulation addresses the case of non-integer literals
head on. I'm not quite sure if it's worth adding another sentence
to do so.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David Rowley 2023-09-18 00:22:55 Re: group by true now errors with non-integer constant in GROUP BY
Previous Message David Rowley 2023-09-17 23:36:42 Re: group by true now errors with non-integer constant in GROUP BY