pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Reject SELECT ... GROUP BY GROUPING SETS (()) FOR UPDATE.
6+ messages / 1 participants
[nested] [flat]

* pgsql: Reject SELECT ... GROUP BY GROUPING SETS (()) FOR UPDATE.
@ 2021-06-01 15:13 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2021-06-01 15:13 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1103033aedc10295eb689a4b7158f21ef4c14a11

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(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Reject SELECT ... GROUP BY GROUPING SETS (()) FOR UPDATE.
@ 2021-06-01 15:13 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2021-06-01 15:13 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/e5b0fffa17f610f03f03952c8c4a247c39e61292

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(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Reject SELECT ... GROUP BY GROUPING SETS (()) FOR UPDATE.
@ 2021-06-01 15:13 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2021-06-01 15:13 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/762fe98b1ba63101bbf1fe8fcd1e23532d2c4f41

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(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Reject SELECT ... GROUP BY GROUPING SETS (()) FOR UPDATE.
@ 2021-06-01 15:13 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2021-06-01 15:13 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/dc272157a8aa1764aa92c013a2813d300f6ca32a

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(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Reject SELECT ... GROUP BY GROUPING SETS (()) FOR UPDATE.
@ 2021-06-01 15:13 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2021-06-01 15:13 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/39862dde4beecdf1c5f84a20fe3bb6f4ba928edb

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(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* pgsql: Reject SELECT ... GROUP BY GROUPING SETS (()) FOR UPDATE.
@ 2021-06-01 15:13 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2021-06-01 15:13 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

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(-)



^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2021-06-01 15:13 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-06-01 15:13 pgsql: Reject SELECT ... GROUP BY GROUPING SETS (()) FOR UPDATE. Tom Lane <tgl@sss.pgh.pa.us>
2021-06-01 15:13 pgsql: Reject SELECT ... GROUP BY GROUPING SETS (()) FOR UPDATE. Tom Lane <tgl@sss.pgh.pa.us>
2021-06-01 15:13 pgsql: Reject SELECT ... GROUP BY GROUPING SETS (()) FOR UPDATE. Tom Lane <tgl@sss.pgh.pa.us>
2021-06-01 15:13 pgsql: Reject SELECT ... GROUP BY GROUPING SETS (()) FOR UPDATE. Tom Lane <tgl@sss.pgh.pa.us>
2021-06-01 15:13 pgsql: Reject SELECT ... GROUP BY GROUPING SETS (()) FOR UPDATE. Tom Lane <tgl@sss.pgh.pa.us>
2021-06-01 15:13 pgsql: Reject SELECT ... GROUP BY GROUPING SETS (()) FOR UPDATE. Tom Lane <tgl@sss.pgh.pa.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