pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Remove inadequate assertion check in CTE inlining.
4+ messages / 1 participants
[nested] [flat]

* pgsql: Remove inadequate assertion check in CTE inlining.
@ 2022-04-21 21:59  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

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

Remove inadequate assertion check in CTE inlining.

inline_cte() expected to find exactly as many references to the
target CTE as its cterefcount indicates.  While that should be
accurate for the tree as emitted by the parser, there are some
optimizations that occur upstream of here that could falsify it,
notably removal of unused subquery output expressions.

Trying to make the accounting 100% accurate seems expensive and
doomed to future breakage.  It's not really worth it, because
all this code is protecting is downstream assumptions that every
referenced CTE has a plan.  Let's convert those assertions to
regular test-and-elog just in case there's some actual problem,
and then drop the failing assertion.

Per report from Tomas Vondra (thanks also to Richard Guo for
analysis).  Back-patch to v12 where the faulty code came in.

Discussion: https://postgr.es/m/29196a1e-ed47-c7ca-9be2-b1c636816183@enterprisedb.com

Branch
------
REL_12_STABLE

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

Modified Files
--------------
src/backend/optimizer/path/allpaths.c   |  3 +-
src/backend/optimizer/plan/createplan.c |  3 +-
src/backend/optimizer/plan/subselect.c  |  8 -----
src/include/nodes/pathnodes.h           |  3 +-
src/test/regress/expected/with.out      | 64 +++++++++++++++++++++++++++++++++
src/test/regress/sql/with.sql           | 31 ++++++++++++++++
6 files changed, 101 insertions(+), 11 deletions(-)



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

* pgsql: Remove inadequate assertion check in CTE inlining.
@ 2022-04-21 21:59  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

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

Remove inadequate assertion check in CTE inlining.

inline_cte() expected to find exactly as many references to the
target CTE as its cterefcount indicates.  While that should be
accurate for the tree as emitted by the parser, there are some
optimizations that occur upstream of here that could falsify it,
notably removal of unused subquery output expressions.

Trying to make the accounting 100% accurate seems expensive and
doomed to future breakage.  It's not really worth it, because
all this code is protecting is downstream assumptions that every
referenced CTE has a plan.  Let's convert those assertions to
regular test-and-elog just in case there's some actual problem,
and then drop the failing assertion.

Per report from Tomas Vondra (thanks also to Richard Guo for
analysis).  Back-patch to v12 where the faulty code came in.

Discussion: https://postgr.es/m/29196a1e-ed47-c7ca-9be2-b1c636816183@enterprisedb.com

Branch
------
REL_13_STABLE

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

Modified Files
--------------
src/backend/optimizer/path/allpaths.c   |  3 +-
src/backend/optimizer/plan/createplan.c |  3 +-
src/backend/optimizer/plan/subselect.c  |  8 -----
src/include/nodes/pathnodes.h           |  3 +-
src/test/regress/expected/with.out      | 64 +++++++++++++++++++++++++++++++++
src/test/regress/sql/with.sql           | 31 ++++++++++++++++
6 files changed, 101 insertions(+), 11 deletions(-)



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

* pgsql: Remove inadequate assertion check in CTE inlining.
@ 2022-04-21 21:59  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

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

Remove inadequate assertion check in CTE inlining.

inline_cte() expected to find exactly as many references to the
target CTE as its cterefcount indicates.  While that should be
accurate for the tree as emitted by the parser, there are some
optimizations that occur upstream of here that could falsify it,
notably removal of unused subquery output expressions.

Trying to make the accounting 100% accurate seems expensive and
doomed to future breakage.  It's not really worth it, because
all this code is protecting is downstream assumptions that every
referenced CTE has a plan.  Let's convert those assertions to
regular test-and-elog just in case there's some actual problem,
and then drop the failing assertion.

Per report from Tomas Vondra (thanks also to Richard Guo for
analysis).  Back-patch to v12 where the faulty code came in.

Discussion: https://postgr.es/m/29196a1e-ed47-c7ca-9be2-b1c636816183@enterprisedb.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/92e7a537520927107742af654619e55f34072942

Modified Files
--------------
src/backend/optimizer/path/allpaths.c   |  3 +-
src/backend/optimizer/plan/createplan.c |  3 +-
src/backend/optimizer/plan/subselect.c  |  8 -----
src/include/nodes/pathnodes.h           |  3 +-
src/test/regress/expected/with.out      | 64 +++++++++++++++++++++++++++++++++
src/test/regress/sql/with.sql           | 31 ++++++++++++++++
6 files changed, 101 insertions(+), 11 deletions(-)



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

* pgsql: Remove inadequate assertion check in CTE inlining.
@ 2022-04-21 21:59  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 4+ messages in thread

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

Remove inadequate assertion check in CTE inlining.

inline_cte() expected to find exactly as many references to the
target CTE as its cterefcount indicates.  While that should be
accurate for the tree as emitted by the parser, there are some
optimizations that occur upstream of here that could falsify it,
notably removal of unused subquery output expressions.

Trying to make the accounting 100% accurate seems expensive and
doomed to future breakage.  It's not really worth it, because
all this code is protecting is downstream assumptions that every
referenced CTE has a plan.  Let's convert those assertions to
regular test-and-elog just in case there's some actual problem,
and then drop the failing assertion.

Per report from Tomas Vondra (thanks also to Richard Guo for
analysis).  Back-patch to v12 where the faulty code came in.

Discussion: https://postgr.es/m/29196a1e-ed47-c7ca-9be2-b1c636816183@enterprisedb.com

Branch
------
REL_14_STABLE

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

Modified Files
--------------
src/backend/optimizer/path/allpaths.c   |  3 +-
src/backend/optimizer/plan/createplan.c |  3 +-
src/backend/optimizer/plan/subselect.c  |  8 -----
src/include/nodes/pathnodes.h           |  3 +-
src/test/regress/expected/with.out      | 64 +++++++++++++++++++++++++++++++++
src/test/regress/sql/with.sql           | 31 ++++++++++++++++
6 files changed, 101 insertions(+), 11 deletions(-)



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


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

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-04-21 21:59 pgsql: Remove inadequate assertion check in CTE inlining. Tom Lane <tgl@sss.pgh.pa.us>
2022-04-21 21:59 pgsql: Remove inadequate assertion check in CTE inlining. Tom Lane <tgl@sss.pgh.pa.us>
2022-04-21 21:59 pgsql: Remove inadequate assertion check in CTE inlining. Tom Lane <tgl@sss.pgh.pa.us>
2022-04-21 21:59 pgsql: Remove inadequate assertion check in CTE inlining. 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