pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Cope with lateral references in the quals of a subquery RTE.
7+ messages / 1 participants
[nested] [flat]

* pgsql: Cope with lateral references in the quals of a subquery RTE.
@ 2020-07-14 00:38  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2020-07-14 00:38 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Cope with lateral references in the quals of a subquery RTE.

The qual pushdown logic assumed that all Vars in a restriction clause
must be Vars referencing subquery outputs; but since we introduced
LATERAL, it's possible for such a Var to be a lateral reference instead.
This led to an assertion failure in debug builds.  In a non-debug
build, there might be no ill effects (if qual_is_pushdown_safe decided
the qual was unsafe anyway), or we could get failures later due to
construction of an invalid plan.  I've not gone to much length to
characterize the possible failures, but at least segfaults in the
executor have been observed.

Given that this has been busted since 9.3 and it took this long for
anybody to notice, I judge that the case isn't worth going to great
lengths to optimize.  Hence, fix by just teaching qual_is_pushdown_safe
that such quals are unsafe to push down, matching the previous behavior
when it accidentally didn't fail.

Per report from Tom Ellis.  Back-patch to all supported branches.

Discussion: https://postgr.es/m/20200713175124.GQ8220@cloudinit-builder

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/6443cd2e242175890ede181b96bf47b0d9b259ce

Modified Files
--------------
src/backend/optimizer/path/allpaths.c   | 20 +++++++++++--
src/test/regress/expected/subselect.out | 53 +++++++++++++++++++++++++++++++++
src/test/regress/sql/subselect.sql      | 26 ++++++++++++++++
3 files changed, 96 insertions(+), 3 deletions(-)



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

* pgsql: Cope with lateral references in the quals of a subquery RTE.
@ 2020-07-14 00:38  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2020-07-14 00:38 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Cope with lateral references in the quals of a subquery RTE.

The qual pushdown logic assumed that all Vars in a restriction clause
must be Vars referencing subquery outputs; but since we introduced
LATERAL, it's possible for such a Var to be a lateral reference instead.
This led to an assertion failure in debug builds.  In a non-debug
build, there might be no ill effects (if qual_is_pushdown_safe decided
the qual was unsafe anyway), or we could get failures later due to
construction of an invalid plan.  I've not gone to much length to
characterize the possible failures, but at least segfaults in the
executor have been observed.

Given that this has been busted since 9.3 and it took this long for
anybody to notice, I judge that the case isn't worth going to great
lengths to optimize.  Hence, fix by just teaching qual_is_pushdown_safe
that such quals are unsafe to push down, matching the previous behavior
when it accidentally didn't fail.

Per report from Tom Ellis.  Back-patch to all supported branches.

Discussion: https://postgr.es/m/20200713175124.GQ8220@cloudinit-builder

Branch
------
REL9_5_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/80d8f6d1d6338c335c84048e65e1203fada863b2

Modified Files
--------------
src/backend/optimizer/path/allpaths.c   | 20 +++++++++++--
src/test/regress/expected/subselect.out | 53 +++++++++++++++++++++++++++++++++
src/test/regress/sql/subselect.sql      | 26 ++++++++++++++++
3 files changed, 96 insertions(+), 3 deletions(-)



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

* pgsql: Cope with lateral references in the quals of a subquery RTE.
@ 2020-07-14 00:38  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2020-07-14 00:38 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Cope with lateral references in the quals of a subquery RTE.

The qual pushdown logic assumed that all Vars in a restriction clause
must be Vars referencing subquery outputs; but since we introduced
LATERAL, it's possible for such a Var to be a lateral reference instead.
This led to an assertion failure in debug builds.  In a non-debug
build, there might be no ill effects (if qual_is_pushdown_safe decided
the qual was unsafe anyway), or we could get failures later due to
construction of an invalid plan.  I've not gone to much length to
characterize the possible failures, but at least segfaults in the
executor have been observed.

Given that this has been busted since 9.3 and it took this long for
anybody to notice, I judge that the case isn't worth going to great
lengths to optimize.  Hence, fix by just teaching qual_is_pushdown_safe
that such quals are unsafe to push down, matching the previous behavior
when it accidentally didn't fail.

Per report from Tom Ellis.  Back-patch to all supported branches.

Discussion: https://postgr.es/m/20200713175124.GQ8220@cloudinit-builder

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/0734dbc45034540fec1d98b15c9f173ad1d4af02

Modified Files
--------------
src/backend/optimizer/path/allpaths.c   | 20 +++++++++++--
src/test/regress/expected/subselect.out | 53 +++++++++++++++++++++++++++++++++
src/test/regress/sql/subselect.sql      | 26 ++++++++++++++++
3 files changed, 96 insertions(+), 3 deletions(-)



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

* pgsql: Cope with lateral references in the quals of a subquery RTE.
@ 2020-07-14 00:38  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2020-07-14 00:38 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Cope with lateral references in the quals of a subquery RTE.

The qual pushdown logic assumed that all Vars in a restriction clause
must be Vars referencing subquery outputs; but since we introduced
LATERAL, it's possible for such a Var to be a lateral reference instead.
This led to an assertion failure in debug builds.  In a non-debug
build, there might be no ill effects (if qual_is_pushdown_safe decided
the qual was unsafe anyway), or we could get failures later due to
construction of an invalid plan.  I've not gone to much length to
characterize the possible failures, but at least segfaults in the
executor have been observed.

Given that this has been busted since 9.3 and it took this long for
anybody to notice, I judge that the case isn't worth going to great
lengths to optimize.  Hence, fix by just teaching qual_is_pushdown_safe
that such quals are unsafe to push down, matching the previous behavior
when it accidentally didn't fail.

Per report from Tom Ellis.  Back-patch to all supported branches.

Discussion: https://postgr.es/m/20200713175124.GQ8220@cloudinit-builder

Branch
------
REL_12_STABLE

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

Modified Files
--------------
src/backend/optimizer/path/allpaths.c   | 20 +++++++++++--
src/test/regress/expected/subselect.out | 53 +++++++++++++++++++++++++++++++++
src/test/regress/sql/subselect.sql      | 26 ++++++++++++++++
3 files changed, 96 insertions(+), 3 deletions(-)



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

* pgsql: Cope with lateral references in the quals of a subquery RTE.
@ 2020-07-14 00:38  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2020-07-14 00:38 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Cope with lateral references in the quals of a subquery RTE.

The qual pushdown logic assumed that all Vars in a restriction clause
must be Vars referencing subquery outputs; but since we introduced
LATERAL, it's possible for such a Var to be a lateral reference instead.
This led to an assertion failure in debug builds.  In a non-debug
build, there might be no ill effects (if qual_is_pushdown_safe decided
the qual was unsafe anyway), or we could get failures later due to
construction of an invalid plan.  I've not gone to much length to
characterize the possible failures, but at least segfaults in the
executor have been observed.

Given that this has been busted since 9.3 and it took this long for
anybody to notice, I judge that the case isn't worth going to great
lengths to optimize.  Hence, fix by just teaching qual_is_pushdown_safe
that such quals are unsafe to push down, matching the previous behavior
when it accidentally didn't fail.

Per report from Tom Ellis.  Back-patch to all supported branches.

Discussion: https://postgr.es/m/20200713175124.GQ8220@cloudinit-builder

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/3753df8f8ae8e16bf81bc809514982b35a94f4a1

Modified Files
--------------
src/backend/optimizer/path/allpaths.c   | 20 +++++++++++--
src/test/regress/expected/subselect.out | 53 +++++++++++++++++++++++++++++++++
src/test/regress/sql/subselect.sql      | 26 ++++++++++++++++
3 files changed, 96 insertions(+), 3 deletions(-)



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

* pgsql: Cope with lateral references in the quals of a subquery RTE.
@ 2020-07-14 00:38  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2020-07-14 00:38 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Cope with lateral references in the quals of a subquery RTE.

The qual pushdown logic assumed that all Vars in a restriction clause
must be Vars referencing subquery outputs; but since we introduced
LATERAL, it's possible for such a Var to be a lateral reference instead.
This led to an assertion failure in debug builds.  In a non-debug
build, there might be no ill effects (if qual_is_pushdown_safe decided
the qual was unsafe anyway), or we could get failures later due to
construction of an invalid plan.  I've not gone to much length to
characterize the possible failures, but at least segfaults in the
executor have been observed.

Given that this has been busted since 9.3 and it took this long for
anybody to notice, I judge that the case isn't worth going to great
lengths to optimize.  Hence, fix by just teaching qual_is_pushdown_safe
that such quals are unsafe to push down, matching the previous behavior
when it accidentally didn't fail.

Per report from Tom Ellis.  Back-patch to all supported branches.

Discussion: https://postgr.es/m/20200713175124.GQ8220@cloudinit-builder

Branch
------
REL9_6_STABLE

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

Modified Files
--------------
src/backend/optimizer/path/allpaths.c   | 20 +++++++++++--
src/test/regress/expected/subselect.out | 53 +++++++++++++++++++++++++++++++++
src/test/regress/sql/subselect.sql      | 26 ++++++++++++++++
3 files changed, 96 insertions(+), 3 deletions(-)



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

* pgsql: Cope with lateral references in the quals of a subquery RTE.
@ 2020-07-14 00:38  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 7+ messages in thread

From: Tom Lane @ 2020-07-14 00:38 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Cope with lateral references in the quals of a subquery RTE.

The qual pushdown logic assumed that all Vars in a restriction clause
must be Vars referencing subquery outputs; but since we introduced
LATERAL, it's possible for such a Var to be a lateral reference instead.
This led to an assertion failure in debug builds.  In a non-debug
build, there might be no ill effects (if qual_is_pushdown_safe decided
the qual was unsafe anyway), or we could get failures later due to
construction of an invalid plan.  I've not gone to much length to
characterize the possible failures, but at least segfaults in the
executor have been observed.

Given that this has been busted since 9.3 and it took this long for
anybody to notice, I judge that the case isn't worth going to great
lengths to optimize.  Hence, fix by just teaching qual_is_pushdown_safe
that such quals are unsafe to push down, matching the previous behavior
when it accidentally didn't fail.

Per report from Tom Ellis.  Back-patch to all supported branches.

Discussion: https://postgr.es/m/20200713175124.GQ8220@cloudinit-builder

Branch
------
master

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

Modified Files
--------------
src/backend/optimizer/path/allpaths.c   | 20 +++++++++++--
src/test/regress/expected/subselect.out | 53 +++++++++++++++++++++++++++++++++
src/test/regress/sql/subselect.sql      | 26 ++++++++++++++++
3 files changed, 96 insertions(+), 3 deletions(-)



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


end of thread, other threads:[~2020-07-14 00:38 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-07-14 00:38 pgsql: Cope with lateral references in the quals of a subquery RTE. Tom Lane <tgl@sss.pgh.pa.us>
2020-07-14 00:38 pgsql: Cope with lateral references in the quals of a subquery RTE. Tom Lane <tgl@sss.pgh.pa.us>
2020-07-14 00:38 pgsql: Cope with lateral references in the quals of a subquery RTE. Tom Lane <tgl@sss.pgh.pa.us>
2020-07-14 00:38 pgsql: Cope with lateral references in the quals of a subquery RTE. Tom Lane <tgl@sss.pgh.pa.us>
2020-07-14 00:38 pgsql: Cope with lateral references in the quals of a subquery RTE. Tom Lane <tgl@sss.pgh.pa.us>
2020-07-14 00:38 pgsql: Cope with lateral references in the quals of a subquery RTE. Tom Lane <tgl@sss.pgh.pa.us>
2020-07-14 00:38 pgsql: Cope with lateral references in the quals of a subquery RTE. 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