pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix mishandling of OLD/NEW references in subqueries in rule acti
6+ messages / 1 participants
[nested] [flat]

* pgsql: Fix mishandling of OLD/NEW references in subqueries in rule acti
@ 2023-02-25 14:51  Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Dean Rasheed @ 2023-02-25 14:51 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix mishandling of OLD/NEW references in subqueries in rule actions.

If a rule action contains a subquery that refers to columns from OLD
or NEW, then those are really lateral references, and the planner will
complain if it sees such things in a subquery that isn't marked as
lateral. However, at rule-definition time, the user isn't required to
mark the subquery with LATERAL, and so it can fail when the rule is
used.

Fix this by marking such subqueries as lateral in the rewriter, at the
point where they're used.

Dean Rasheed and Tom Lane, per report from Alexander Lakhin.
Back-patch to all supported branches.

Discussion: https://postgr.es/m/5e09da43-aaba-7ea7-0a51-a2eb981b058b%40gmail.com

Branch
------
master

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

Modified Files
--------------
src/backend/rewrite/rewriteHandler.c | 22 ++++++++++++++++++----
src/test/regress/expected/rules.out  | 25 +++++++++++++++++++++++++
src/test/regress/sql/rules.sql       | 17 +++++++++++++++++
3 files changed, 60 insertions(+), 4 deletions(-)



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

* pgsql: Fix mishandling of OLD/NEW references in subqueries in rule acti
@ 2023-02-25 14:51  Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Dean Rasheed @ 2023-02-25 14:51 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix mishandling of OLD/NEW references in subqueries in rule actions.

If a rule action contains a subquery that refers to columns from OLD
or NEW, then those are really lateral references, and the planner will
complain if it sees such things in a subquery that isn't marked as
lateral. However, at rule-definition time, the user isn't required to
mark the subquery with LATERAL, and so it can fail when the rule is
used.

Fix this by marking such subqueries as lateral in the rewriter, at the
point where they're used.

Dean Rasheed and Tom Lane, per report from Alexander Lakhin.
Back-patch to all supported branches.

Discussion: https://postgr.es/m/5e09da43-aaba-7ea7-0a51-a2eb981b058b%40gmail.com

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/8e5b4e0013a8a24644243cdb9516ac52287a81c8

Modified Files
--------------
src/backend/rewrite/rewriteHandler.c | 22 ++++++++++++++++++----
src/test/regress/expected/rules.out  | 25 +++++++++++++++++++++++++
src/test/regress/sql/rules.sql       | 17 +++++++++++++++++
3 files changed, 60 insertions(+), 4 deletions(-)



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

* pgsql: Fix mishandling of OLD/NEW references in subqueries in rule acti
@ 2023-02-25 14:51  Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Dean Rasheed @ 2023-02-25 14:51 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix mishandling of OLD/NEW references in subqueries in rule actions.

If a rule action contains a subquery that refers to columns from OLD
or NEW, then those are really lateral references, and the planner will
complain if it sees such things in a subquery that isn't marked as
lateral. However, at rule-definition time, the user isn't required to
mark the subquery with LATERAL, and so it can fail when the rule is
used.

Fix this by marking such subqueries as lateral in the rewriter, at the
point where they're used.

Dean Rasheed and Tom Lane, per report from Alexander Lakhin.
Back-patch to all supported branches.

Discussion: https://postgr.es/m/5e09da43-aaba-7ea7-0a51-a2eb981b058b%40gmail.com

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/27ff93d18c2ba921cfbb9e2e38f5fb66c130bc9f

Modified Files
--------------
src/backend/rewrite/rewriteHandler.c | 22 ++++++++++++++++++----
src/test/regress/expected/rules.out  | 25 +++++++++++++++++++++++++
src/test/regress/sql/rules.sql       | 17 +++++++++++++++++
3 files changed, 60 insertions(+), 4 deletions(-)



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

* pgsql: Fix mishandling of OLD/NEW references in subqueries in rule acti
@ 2023-02-25 14:51  Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Dean Rasheed @ 2023-02-25 14:51 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix mishandling of OLD/NEW references in subqueries in rule actions.

If a rule action contains a subquery that refers to columns from OLD
or NEW, then those are really lateral references, and the planner will
complain if it sees such things in a subquery that isn't marked as
lateral. However, at rule-definition time, the user isn't required to
mark the subquery with LATERAL, and so it can fail when the rule is
used.

Fix this by marking such subqueries as lateral in the rewriter, at the
point where they're used.

Dean Rasheed and Tom Lane, per report from Alexander Lakhin.
Back-patch to all supported branches.

Discussion: https://postgr.es/m/5e09da43-aaba-7ea7-0a51-a2eb981b058b%40gmail.com

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/39ad791e851022bc88feca4637118e7b589f5f3a

Modified Files
--------------
src/backend/rewrite/rewriteHandler.c | 22 ++++++++++++++++++----
src/test/regress/expected/rules.out  | 25 +++++++++++++++++++++++++
src/test/regress/sql/rules.sql       | 17 +++++++++++++++++
3 files changed, 60 insertions(+), 4 deletions(-)



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

* pgsql: Fix mishandling of OLD/NEW references in subqueries in rule acti
@ 2023-02-25 14:51  Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Dean Rasheed @ 2023-02-25 14:51 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix mishandling of OLD/NEW references in subqueries in rule actions.

If a rule action contains a subquery that refers to columns from OLD
or NEW, then those are really lateral references, and the planner will
complain if it sees such things in a subquery that isn't marked as
lateral. However, at rule-definition time, the user isn't required to
mark the subquery with LATERAL, and so it can fail when the rule is
used.

Fix this by marking such subqueries as lateral in the rewriter, at the
point where they're used.

Dean Rasheed and Tom Lane, per report from Alexander Lakhin.
Back-patch to all supported branches.

Discussion: https://postgr.es/m/5e09da43-aaba-7ea7-0a51-a2eb981b058b%40gmail.com

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/4fd093af7186e9e3bad805e580edd1991f8f3350

Modified Files
--------------
src/backend/rewrite/rewriteHandler.c | 22 ++++++++++++++++++----
src/test/regress/expected/rules.out  | 25 +++++++++++++++++++++++++
src/test/regress/sql/rules.sql       | 17 +++++++++++++++++
3 files changed, 60 insertions(+), 4 deletions(-)



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

* pgsql: Fix mishandling of OLD/NEW references in subqueries in rule acti
@ 2023-02-25 14:51  Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Dean Rasheed @ 2023-02-25 14:51 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix mishandling of OLD/NEW references in subqueries in rule actions.

If a rule action contains a subquery that refers to columns from OLD
or NEW, then those are really lateral references, and the planner will
complain if it sees such things in a subquery that isn't marked as
lateral. However, at rule-definition time, the user isn't required to
mark the subquery with LATERAL, and so it can fail when the rule is
used.

Fix this by marking such subqueries as lateral in the rewriter, at the
point where they're used.

Dean Rasheed and Tom Lane, per report from Alexander Lakhin.
Back-patch to all supported branches.

Discussion: https://postgr.es/m/5e09da43-aaba-7ea7-0a51-a2eb981b058b%40gmail.com

Branch
------
REL_11_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/79f194cc0144fad07fa18c4b2a5f32bce9035ee0

Modified Files
--------------
src/backend/rewrite/rewriteHandler.c | 23 +++++++++++++++++++----
src/test/regress/expected/rules.out  | 25 +++++++++++++++++++++++++
src/test/regress/sql/rules.sql       | 17 +++++++++++++++++
3 files changed, 61 insertions(+), 4 deletions(-)



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


end of thread, other threads:[~2023-02-25 14:51 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-02-25 14:51 pgsql: Fix mishandling of OLD/NEW references in subqueries in rule acti Dean Rasheed <dean.a.rasheed@gmail.com>
2023-02-25 14:51 pgsql: Fix mishandling of OLD/NEW references in subqueries in rule acti Dean Rasheed <dean.a.rasheed@gmail.com>
2023-02-25 14:51 pgsql: Fix mishandling of OLD/NEW references in subqueries in rule acti Dean Rasheed <dean.a.rasheed@gmail.com>
2023-02-25 14:51 pgsql: Fix mishandling of OLD/NEW references in subqueries in rule acti Dean Rasheed <dean.a.rasheed@gmail.com>
2023-02-25 14:51 pgsql: Fix mishandling of OLD/NEW references in subqueries in rule acti Dean Rasheed <dean.a.rasheed@gmail.com>
2023-02-25 14:51 pgsql: Fix mishandling of OLD/NEW references in subqueries in rule acti Dean Rasheed <dean.a.rasheed@gmail.com>

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