pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: David Rowley <dgrowleyml@gmail.com>
Cc: John Naylor <john.naylor@enterprisedb.com>
Cc: David Micallef <david.j.micallef@gmail.com>
Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: group by true now errors with non-integer constant in GROUP BY
Date: Sun, 17 Sep 2023 20:00:55 -0400
Message-ID: <4153025.1694995255@sss.pgh.pa.us> (raw)
In-Reply-To: <CAApHDvqng3N-AvOT2kkA_PydXfbQpTjU3a_dznSJNT6XOcUUew@mail.gmail.com>
References: <CAJBCwCS7OuEUmGkrnu5Q8SmBP10njnEiX7vJiaxJURZXcCORyw@mail.gmail.com>
	<CAFBsxsE_zy1Y=u2ZM6xZHFY2Cwfr_Uii=-irsHtCxrh6GnfBNA@mail.gmail.com>
	<837886.1693252560@sss.pgh.pa.us>
	<CAApHDvrSUvb1ODvNcYGHz4O6WEsPChhwmSkJcs_3y5pniN2p+A@mail.gmail.com>
	<894521.1693270957@sss.pgh.pa.us>
	<CAApHDvomA1bZy=0AYUcTjDWaCeedcPeDBo6PV0VhpVeo2jG1uQ@mail.gmail.com>
	<CAFBsxsGUawBMKJfxwnce4R2Qpc_sfsiGc-1yJyFDWoNLwz5Zig@mail.gmail.com>
	<CAApHDvqng3N-AvOT2kkA_PydXfbQpTjU3a_dznSJNT6XOcUUew@mail.gmail.com>

David Rowley <dgrowleyml@gmail.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





view thread (20+ messages)  latest in thread

Message-ID: <4153025.1694995255@sss.pgh.pa.us>
Permalink:  ../4153025.1694995255@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/4153025.1694995255@sss.pgh.pa.us

 · 

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-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, dgrowleyml@gmail.com, john.naylor@enterprisedb.com, david.j.micallef@gmail.com, peter.eisentraut@enterprisedb.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: group by true now errors with non-integer constant in GROUP BY
  In-Reply-To: <4153025.1694995255@sss.pgh.pa.us>

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

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