pg.ddx.io pgsql-committers@postgresql.org mailing list archive
help / color / mirror / Atom feedpgsql: Re-allow DISTINCT in pl/pgsql expressions.
7+ messages / 2 participants
[nested] [flat]
Commits from this thread:
2021-01-23 3fc81ce459 Suppress bison warning in ecpg grammar.
* pgsql: Re-allow DISTINCT in pl/pgsql expressions.
@ 2021-01-22 21:26 Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 7+ messages in thread
From: Tom Lane @ 2021-01-22 21:26 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
Re-allow DISTINCT in pl/pgsql expressions.
I'd omitted this from the grammar in commit c9d529848, figuring that
it wasn't worth supporting. However we already have one complaint,
so it seems that judgment was wrong. It doesn't require a huge
amount of code, so add it back. (I'm still drawing the line at
UNION/INTERSECT/EXCEPT though: those'd require an unreasonable
amount of grammar refactoring, and the single-result-row restriction
makes them near useless anyway.)
Also rethink the documentation: this behavior is a property of
all pl/pgsql expressions, not just assignments.
Discussion: https://postgr.es/m/20210122134106.e94c5cd7@mail.verfriemelt.org
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/7cd9765f9bd3397b8d4d0f507021ef848b6d48d2
Modified Files
--------------
doc/src/sgml/plpgsql.sgml | 32 ++++++++++++++++++--------------
src/backend/parser/analyze.c | 29 ++++++++++++++++++++++++-----
src/backend/parser/gram.y | 44 ++++++++++++++++++++++++++++----------------
3 files changed, 70 insertions(+), 35 deletions(-)
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: pgsql: Re-allow DISTINCT in pl/pgsql expressions.
@ 2021-01-23 00:04 Bruce Momjian <bruce@momjian.us>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 2 replies; 7+ messages in thread
From: Bruce Momjian @ 2021-01-23 00:04 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-committers@lists.postgresql.org
On Fri, Jan 22, 2021 at 09:26:29PM +0000, Tom Lane wrote:
> Re-allow DISTINCT in pl/pgsql expressions.
>
> I'd omitted this from the grammar in commit c9d529848, figuring that
> it wasn't worth supporting. However we already have one complaint,
> so it seems that judgment was wrong. It doesn't require a huge
> amount of code, so add it back. (I'm still drawing the line at
> UNION/INTERSECT/EXCEPT though: those'd require an unreasonable
> amount of grammar refactoring, and the single-result-row restriction
> makes them near useless anyway.)
>
> Also rethink the documentation: this behavior is a property of
> all pl/pgsql expressions, not just assignments.
>
> Discussion: https://postgr.es/m/20210122134106.e94c5cd7@mail.verfriemelt.org
I am seeing a warning generated by preproc.y, which is generated via
Perl from gram.y, which was modified by this commit. The bison output
is:
$ /usr/bin/bison -Wno-deprecated -d -o preproc.c preproc.y
preproc.y: warning: 1 nonterminal useless in grammar [-Wother]
preproc.y: warning: 2 rules useless in grammar [-Wother]
preproc.y:10134.2-20: warning: nonterminal useless in grammar: opt_distinct_clause [-Wother]
opt_distinct_clause:
^~~~~~~~~~~~~~~~~~~
I only see it when I do a "make maintainer-clean" before the make
because "make clean" does not remove preproc.y.
--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EDB https://enterprisedb.com
The usefulness of a cup is in its emptiness, Bruce Lee
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: pgsql: Re-allow DISTINCT in pl/pgsql expressions.
@ 2021-01-23 00:09 Bruce Momjian <bruce@momjian.us>
parent: Bruce Momjian <bruce@momjian.us>
1 sibling, 0 replies; 7+ messages in thread
From: Bruce Momjian @ 2021-01-23 00:09 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-committers@lists.postgresql.org
On Fri, Jan 22, 2021 at 07:04:20PM -0500, Bruce Momjian wrote:
> On Fri, Jan 22, 2021 at 09:26:29PM +0000, Tom Lane wrote:
> > Re-allow DISTINCT in pl/pgsql expressions.
> >
> > I'd omitted this from the grammar in commit c9d529848, figuring that
> > it wasn't worth supporting. However we already have one complaint,
> > so it seems that judgment was wrong. It doesn't require a huge
> > amount of code, so add it back. (I'm still drawing the line at
> > UNION/INTERSECT/EXCEPT though: those'd require an unreasonable
> > amount of grammar refactoring, and the single-result-row restriction
> > makes them near useless anyway.)
> >
> > Also rethink the documentation: this behavior is a property of
> > all pl/pgsql expressions, not just assignments.
> >
> > Discussion: https://postgr.es/m/20210122134106.e94c5cd7@mail.verfriemelt.org
>
> I am seeing a warning generated by preproc.y, which is generated via
> Perl from gram.y, which was modified by this commit. The bison output
> is:
>
> $ /usr/bin/bison -Wno-deprecated -d -o preproc.c preproc.y
> preproc.y: warning: 1 nonterminal useless in grammar [-Wother]
> preproc.y: warning: 2 rules useless in grammar [-Wother]
> preproc.y:10134.2-20: warning: nonterminal useless in grammar: opt_distinct_clause [-Wother]
> opt_distinct_clause:
> ^~~~~~~~~~~~~~~~~~~
>
> I only see it when I do a "make maintainer-clean" before the make
> because "make clean" does not remove preproc.y.
Sorry, this is Bison version 3.3.2, included in Debian 10.
--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EDB https://enterprisedb.com
The usefulness of a cup is in its emptiness, Bruce Lee
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: pgsql: Re-allow DISTINCT in pl/pgsql expressions.
@ 2021-01-23 00:16 Tom Lane <tgl@sss.pgh.pa.us>
parent: Bruce Momjian <bruce@momjian.us>
1 sibling, 1 reply; 7+ messages in thread
From: Tom Lane @ 2021-01-23 00:16 UTC (permalink / raw)
To: Bruce Momjian <bruce@momjian.us>; +Cc: pgsql-committers@lists.postgresql.org
Bruce Momjian <bruce@momjian.us> writes:
> On Fri, Jan 22, 2021 at 09:26:29PM +0000, Tom Lane wrote:
>> Re-allow DISTINCT in pl/pgsql expressions.
> I am seeing a warning generated by preproc.y, which is generated via
> Perl from gram.y, which was modified by this commit.
Mea culpa, didn't think to try the ecpg tests.
regards, tom lane
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: pgsql: Re-allow DISTINCT in pl/pgsql expressions.
@ 2021-01-23 00:18 Bruce Momjian <bruce@momjian.us>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 7+ messages in thread
From: Bruce Momjian @ 2021-01-23 00:18 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-committers@lists.postgresql.org
On Fri, Jan 22, 2021 at 07:16:34PM -0500, Tom Lane wrote:
> Bruce Momjian <bruce@momjian.us> writes:
> > On Fri, Jan 22, 2021 at 09:26:29PM +0000, Tom Lane wrote:
> >> Re-allow DISTINCT in pl/pgsql expressions.
>
> > I am seeing a warning generated by preproc.y, which is generated via
> > Perl from gram.y, which was modified by this commit.
>
> Mea culpa, didn't think to try the ecpg tests.
I only found it because of the private test harness I use which checks
for anything unusual in the compile logs.
--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EDB https://enterprisedb.com
The usefulness of a cup is in its emptiness, Bruce Lee
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: pgsql: Re-allow DISTINCT in pl/pgsql expressions.
@ 2021-01-23 00:32 Tom Lane <tgl@sss.pgh.pa.us>
parent: Bruce Momjian <bruce@momjian.us>
0 siblings, 1 reply; 7+ messages in thread
From: Tom Lane @ 2021-01-23 00:32 UTC (permalink / raw)
To: Bruce Momjian <bruce@momjian.us>; +Cc: pgsql-committers@lists.postgresql.org
Bruce Momjian <bruce@momjian.us> writes:
> On Fri, Jan 22, 2021 at 07:16:34PM -0500, Tom Lane wrote:
>> Mea culpa, didn't think to try the ecpg tests.
> I only found it because of the private test harness I use which checks
> for anything unusual in the compile logs.
Actually, I *did* run check-world before committing, so I'm not sure
how I missed the warning. Oh well.
regards, tom lane
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: pgsql: Re-allow DISTINCT in pl/pgsql expressions.
@ 2021-01-23 00:48 Bruce Momjian <bruce@momjian.us>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 7+ messages in thread
From: Bruce Momjian @ 2021-01-23 00:48 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-committers@lists.postgresql.org
On Fri, Jan 22, 2021 at 07:32:07PM -0500, Tom Lane wrote:
> Bruce Momjian <bruce@momjian.us> writes:
> > On Fri, Jan 22, 2021 at 07:16:34PM -0500, Tom Lane wrote:
> >> Mea culpa, didn't think to try the ecpg tests.
>
> > I only found it because of the private test harness I use which checks
> > for anything unusual in the compile logs.
>
> Actually, I *did* run check-world before committing, so I'm not sure
> how I missed the warning. Oh well.
I can confirm the fix, thanks.
--
Bruce Momjian <bruce@momjian.us> https://momjian.us
EDB https://enterprisedb.com
The usefulness of a cup is in its emptiness, Bruce Lee
^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~2021-01-23 00:48 UTC | newest]
Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-01-22 21:26 pgsql: Re-allow DISTINCT in pl/pgsql expressions. Tom Lane <tgl@sss.pgh.pa.us>
2021-01-23 00:04 ` Bruce Momjian <bruce@momjian.us>
2021-01-23 00:09 ` Bruce Momjian <bruce@momjian.us>
2021-01-23 00:16 ` Tom Lane <tgl@sss.pgh.pa.us>
2021-01-23 00:18 ` Bruce Momjian <bruce@momjian.us>
2021-01-23 00:32 ` Tom Lane <tgl@sss.pgh.pa.us>
2021-01-23 00:48 ` Bruce Momjian <bruce@momjian.us>
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