pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix assorted missing logic for GroupingFunc nodes.
6+ messages / 1 participants
[nested] [flat]

* pgsql: Fix assorted missing logic for GroupingFunc nodes.
@ 2022-03-21 21:44  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2022-03-21 21:44 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix assorted missing logic for GroupingFunc nodes.

The planner needs to treat GroupingFunc like Aggref for many purposes,
in particular with respect to processing of the argument expressions,
which are not to be evaluated at runtime.  A few places hadn't gotten
that memo, notably including subselect.c's processing of outer-level
aggregates.  This resulted in assertion failures or wrong plans for
cases in which a GROUPING() construct references an outer aggregation
level.

Also fix missing special cases for GroupingFunc in cost_qual_eval
(resulting in wrong cost estimates for GROUPING(), although it's
not clear that that would affect plan shapes in practice) and in
ruleutils.c (resulting in excess parentheses in pretty-print mode).

Per bug #17088 from Yaoguang Chen.  Back-patch to all supported
branches.

Richard Guo, Tom Lane

Discussion: https://postgr.es/m/17088-e33882b387de7f5c@postgresql.org

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/48b6035f0f72c312aaa22733cb88f5290f473ac0

Modified Files
--------------
src/backend/nodes/nodeFuncs.c              |  2 ++
src/backend/optimizer/path/costsize.c      |  6 ++++
src/backend/optimizer/plan/subselect.c     | 30 ++++++++++++--------
src/backend/utils/adt/ruleutils.c          | 10 +++++--
src/test/regress/expected/groupingsets.out | 45 ++++++++++++++++++++++++++++++
src/test/regress/sql/groupingsets.sql      |  9 ++++++
6 files changed, 88 insertions(+), 14 deletions(-)



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

* pgsql: Fix assorted missing logic for GroupingFunc nodes.
@ 2022-03-21 21:44  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2022-03-21 21:44 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix assorted missing logic for GroupingFunc nodes.

The planner needs to treat GroupingFunc like Aggref for many purposes,
in particular with respect to processing of the argument expressions,
which are not to be evaluated at runtime.  A few places hadn't gotten
that memo, notably including subselect.c's processing of outer-level
aggregates.  This resulted in assertion failures or wrong plans for
cases in which a GROUPING() construct references an outer aggregation
level.

Also fix missing special cases for GroupingFunc in cost_qual_eval
(resulting in wrong cost estimates for GROUPING(), although it's
not clear that that would affect plan shapes in practice) and in
ruleutils.c (resulting in excess parentheses in pretty-print mode).

Per bug #17088 from Yaoguang Chen.  Back-patch to all supported
branches.

Richard Guo, Tom Lane

Discussion: https://postgr.es/m/17088-e33882b387de7f5c@postgresql.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/2591ee8ec44d8cbc8e1226550337a64c684746e4

Modified Files
--------------
src/backend/nodes/nodeFuncs.c              |  2 ++
src/backend/optimizer/path/costsize.c      |  6 ++++
src/backend/optimizer/plan/subselect.c     | 30 ++++++++++++--------
src/backend/utils/adt/ruleutils.c          | 10 +++++--
src/test/regress/expected/groupingsets.out | 45 ++++++++++++++++++++++++++++++
src/test/regress/sql/groupingsets.sql      |  9 ++++++
6 files changed, 88 insertions(+), 14 deletions(-)



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

* pgsql: Fix assorted missing logic for GroupingFunc nodes.
@ 2022-03-21 21:44  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2022-03-21 21:44 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix assorted missing logic for GroupingFunc nodes.

The planner needs to treat GroupingFunc like Aggref for many purposes,
in particular with respect to processing of the argument expressions,
which are not to be evaluated at runtime.  A few places hadn't gotten
that memo, notably including subselect.c's processing of outer-level
aggregates.  This resulted in assertion failures or wrong plans for
cases in which a GROUPING() construct references an outer aggregation
level.

Also fix missing special cases for GroupingFunc in cost_qual_eval
(resulting in wrong cost estimates for GROUPING(), although it's
not clear that that would affect plan shapes in practice) and in
ruleutils.c (resulting in excess parentheses in pretty-print mode).

Per bug #17088 from Yaoguang Chen.  Back-patch to all supported
branches.

Richard Guo, Tom Lane

Discussion: https://postgr.es/m/17088-e33882b387de7f5c@postgresql.org

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/69c88e2fb0aa77499d5dc9de42f13cb2f8afd65d

Modified Files
--------------
src/backend/nodes/nodeFuncs.c              |  2 ++
src/backend/optimizer/path/costsize.c      |  6 ++++
src/backend/optimizer/plan/subselect.c     | 30 ++++++++++++--------
src/backend/utils/adt/ruleutils.c          | 10 +++++--
src/test/regress/expected/groupingsets.out | 45 ++++++++++++++++++++++++++++++
src/test/regress/sql/groupingsets.sql      |  9 ++++++
6 files changed, 88 insertions(+), 14 deletions(-)



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

* pgsql: Fix assorted missing logic for GroupingFunc nodes.
@ 2022-03-21 21:44  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2022-03-21 21:44 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix assorted missing logic for GroupingFunc nodes.

The planner needs to treat GroupingFunc like Aggref for many purposes,
in particular with respect to processing of the argument expressions,
which are not to be evaluated at runtime.  A few places hadn't gotten
that memo, notably including subselect.c's processing of outer-level
aggregates.  This resulted in assertion failures or wrong plans for
cases in which a GROUPING() construct references an outer aggregation
level.

Also fix missing special cases for GroupingFunc in cost_qual_eval
(resulting in wrong cost estimates for GROUPING(), although it's
not clear that that would affect plan shapes in practice) and in
ruleutils.c (resulting in excess parentheses in pretty-print mode).

Per bug #17088 from Yaoguang Chen.  Back-patch to all supported
branches.

Richard Guo, Tom Lane

Discussion: https://postgr.es/m/17088-e33882b387de7f5c@postgresql.org

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/2afa031ac552995e2b6ba5371388bff280e7cfe8

Modified Files
--------------
src/backend/nodes/nodeFuncs.c              |  2 ++
src/backend/optimizer/path/costsize.c      |  6 ++++
src/backend/optimizer/plan/subselect.c     | 30 +++++++++++-------
src/backend/utils/adt/ruleutils.c          | 10 ++++--
src/test/regress/expected/groupingsets.out | 49 ++++++++++++++++++++++++++++++
src/test/regress/sql/groupingsets.sql      |  9 ++++++
6 files changed, 92 insertions(+), 14 deletions(-)



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

* pgsql: Fix assorted missing logic for GroupingFunc nodes.
@ 2022-03-21 21:44  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2022-03-21 21:44 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix assorted missing logic for GroupingFunc nodes.

The planner needs to treat GroupingFunc like Aggref for many purposes,
in particular with respect to processing of the argument expressions,
which are not to be evaluated at runtime.  A few places hadn't gotten
that memo, notably including subselect.c's processing of outer-level
aggregates.  This resulted in assertion failures or wrong plans for
cases in which a GROUPING() construct references an outer aggregation
level.

Also fix missing special cases for GroupingFunc in cost_qual_eval
(resulting in wrong cost estimates for GROUPING(), although it's
not clear that that would affect plan shapes in practice) and in
ruleutils.c (resulting in excess parentheses in pretty-print mode).

Per bug #17088 from Yaoguang Chen.  Back-patch to all supported
branches.

Richard Guo, Tom Lane

Discussion: https://postgr.es/m/17088-e33882b387de7f5c@postgresql.org

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/5de244196a5b56640189582aa41ac74592d1dd09

Modified Files
--------------
src/backend/nodes/nodeFuncs.c              |  2 ++
src/backend/optimizer/path/costsize.c      |  6 ++++
src/backend/optimizer/plan/subselect.c     | 30 +++++++++++-------
src/backend/utils/adt/ruleutils.c          | 10 ++++--
src/test/regress/expected/groupingsets.out | 49 ++++++++++++++++++++++++++++++
src/test/regress/sql/groupingsets.sql      |  9 ++++++
6 files changed, 92 insertions(+), 14 deletions(-)



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

* pgsql: Fix assorted missing logic for GroupingFunc nodes.
@ 2022-03-21 21:44  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 6+ messages in thread

From: Tom Lane @ 2022-03-21 21:44 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix assorted missing logic for GroupingFunc nodes.

The planner needs to treat GroupingFunc like Aggref for many purposes,
in particular with respect to processing of the argument expressions,
which are not to be evaluated at runtime.  A few places hadn't gotten
that memo, notably including subselect.c's processing of outer-level
aggregates.  This resulted in assertion failures or wrong plans for
cases in which a GROUPING() construct references an outer aggregation
level.

Also fix missing special cases for GroupingFunc in cost_qual_eval
(resulting in wrong cost estimates for GROUPING(), although it's
not clear that that would affect plan shapes in practice) and in
ruleutils.c (resulting in excess parentheses in pretty-print mode).

Per bug #17088 from Yaoguang Chen.  Back-patch to all supported
branches.

Richard Guo, Tom Lane

Discussion: https://postgr.es/m/17088-e33882b387de7f5c@postgresql.org

Branch
------
REL_13_STABLE

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

Modified Files
--------------
src/backend/nodes/nodeFuncs.c              |  2 ++
src/backend/optimizer/path/costsize.c      |  6 ++++
src/backend/optimizer/plan/subselect.c     | 30 ++++++++++++--------
src/backend/utils/adt/ruleutils.c          | 10 +++++--
src/test/regress/expected/groupingsets.out | 45 ++++++++++++++++++++++++++++++
src/test/regress/sql/groupingsets.sql      |  9 ++++++
6 files changed, 88 insertions(+), 14 deletions(-)



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


end of thread, other threads:[~2022-03-21 21:44 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-03-21 21:44 pgsql: Fix assorted missing logic for GroupingFunc nodes. Tom Lane <tgl@sss.pgh.pa.us>
2022-03-21 21:44 pgsql: Fix assorted missing logic for GroupingFunc nodes. Tom Lane <tgl@sss.pgh.pa.us>
2022-03-21 21:44 pgsql: Fix assorted missing logic for GroupingFunc nodes. Tom Lane <tgl@sss.pgh.pa.us>
2022-03-21 21:44 pgsql: Fix assorted missing logic for GroupingFunc nodes. Tom Lane <tgl@sss.pgh.pa.us>
2022-03-21 21:44 pgsql: Fix assorted missing logic for GroupingFunc nodes. Tom Lane <tgl@sss.pgh.pa.us>
2022-03-21 21:44 pgsql: Fix assorted missing logic for GroupingFunc nodes. 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