| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> | 
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org | 
| Subject: | pgsql: Reject SELECT ... GROUP BY GROUPING SETS (()) FOR UPDATE. | 
| Date: | 2021-06-01 15:13:38 | 
| Message-ID: | E1lo65K-0007Hd-Di@gemulon.postgresql.org | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-committers | 
Reject SELECT ... GROUP BY GROUPING SETS (()) FOR UPDATE.
This case should be disallowed, just as FOR UPDATE with a plain
GROUP BY is disallowed; FOR UPDATE only makes sense when each row
of the query result can be identified with a single table row.
However, we missed teaching CheckSelectLocking() to check
groupingSets as well as groupClause, so that it would allow
degenerate grouping sets.  That resulted in a bad plan and
a null-pointer dereference in the executor.
Looking around for other instances of the same bug, the only one
I found was in examine_simple_variable().  That'd just lead to
silly estimates, but it should be fixed too.
Per private report from Yaoguang Chen.
Back-patch to all supported branches.
Branch
------
REL9_6_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/3eca18522e1908f7a61ab2545bb9238fce4d1ba7
Modified Files
--------------
src/backend/parser/analyze.c         | 2 +-
src/backend/utils/adt/selfuncs.c     | 3 ++-
src/test/regress/expected/errors.out | 5 +++++
src/test/regress/sql/errors.sql      | 4 ++++
4 files changed, 12 insertions(+), 2 deletions(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Noah Misch | 2021-06-02 01:08:20 | pgsql: Add Windows file version information to libpq_pipeline.exe. | 
| Previous Message | Amit Kapila | 2021-06-01 08:58:47 | pgsql: pgoutput: Fix memory leak due to RelationSyncEntry.map. |