pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix alias matching in transformLockingClause().
7+ messages / 1 participants
[nested] [flat]

* pgsql: Fix alias matching in transformLockingClause().
@ 2022-07-07 12:14 Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 7+ messages in thread

From: Dean Rasheed @ 2022-07-07 12:14 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix alias matching in transformLockingClause().

When locking a specific named relation for a FOR [KEY] UPDATE/SHARE
clause, transformLockingClause() finds the relation to lock by
scanning the rangetable for an RTE with a matching eref->aliasname.
However, it failed to account for the visibility rules of a join RTE.

If a join RTE doesn't have a user-supplied alias, it will have a
generated eref->aliasname of "unnamed_join" that is not visible as a
relation name in the parse namespace. Such an RTE needs to be skipped,
otherwise it might be found in preference to a regular base relation
with a user-supplied alias of "unnamed_join", preventing it from being
locked.

In addition, if a join RTE doesn't have a user-supplied alias, but
does have a join_using_alias, then the RTE needs to be matched using
that alias rather than the generated eref->aliasname, otherwise a
misleading "relation not found" error will be reported rather than a
"join cannot be locked" error.

Backpatch all the way, except for the second part which only goes back
to 14, where JOIN USING aliases were added.

Dean Rasheed, reviewed by Tom Lane.

Discussion: https://postgr.es/m/CAEZATCUY_KOBnqxbTSPf=7fz9HWPnZ5Xgb9SwYzZ8rFXe7nb=w@mail.gmail.com

Branch
------
master

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

Modified Files
--------------
src/backend/parser/analyze.c       | 19 ++++++++++++++++++-
src/test/regress/expected/join.out | 33 +++++++++++++++++++++++++++++++++
src/test/regress/sql/join.sql      | 22 ++++++++++++++++++++++
3 files changed, 73 insertions(+), 1 deletion(-)



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

* pgsql: Fix alias matching in transformLockingClause().
@ 2022-07-07 12:14 Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 7+ messages in thread

From: Dean Rasheed @ 2022-07-07 12:14 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix alias matching in transformLockingClause().

When locking a specific named relation for a FOR [KEY] UPDATE/SHARE
clause, transformLockingClause() finds the relation to lock by
scanning the rangetable for an RTE with a matching eref->aliasname.
However, it failed to account for the visibility rules of a join RTE.

If a join RTE doesn't have a user-supplied alias, it will have a
generated eref->aliasname of "unnamed_join" that is not visible as a
relation name in the parse namespace. Such an RTE needs to be skipped,
otherwise it might be found in preference to a regular base relation
with a user-supplied alias of "unnamed_join", preventing it from being
locked.

In addition, if a join RTE doesn't have a user-supplied alias, but
does have a join_using_alias, then the RTE needs to be matched using
that alias rather than the generated eref->aliasname, otherwise a
misleading "relation not found" error will be reported rather than a
"join cannot be locked" error.

Backpatch all the way, except for the second part which only goes back
to 14, where JOIN USING aliases were added.

Dean Rasheed, reviewed by Tom Lane.

Discussion: https://postgr.es/m/CAEZATCUY_KOBnqxbTSPf=7fz9HWPnZ5Xgb9SwYzZ8rFXe7nb=w@mail.gmail.com

Branch
------
REL_15_STABLE

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

Modified Files
--------------
src/backend/parser/analyze.c       | 19 ++++++++++++++++++-
src/test/regress/expected/join.out | 33 +++++++++++++++++++++++++++++++++
src/test/regress/sql/join.sql      | 22 ++++++++++++++++++++++
3 files changed, 73 insertions(+), 1 deletion(-)



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

* pgsql: Fix alias matching in transformLockingClause().
@ 2022-07-07 12:14 Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 7+ messages in thread

From: Dean Rasheed @ 2022-07-07 12:14 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix alias matching in transformLockingClause().

When locking a specific named relation for a FOR [KEY] UPDATE/SHARE
clause, transformLockingClause() finds the relation to lock by
scanning the rangetable for an RTE with a matching eref->aliasname.
However, it failed to account for the visibility rules of a join RTE.

If a join RTE doesn't have a user-supplied alias, it will have a
generated eref->aliasname of "unnamed_join" that is not visible as a
relation name in the parse namespace. Such an RTE needs to be skipped,
otherwise it might be found in preference to a regular base relation
with a user-supplied alias of "unnamed_join", preventing it from being
locked.

In addition, if a join RTE doesn't have a user-supplied alias, but
does have a join_using_alias, then the RTE needs to be matched using
that alias rather than the generated eref->aliasname, otherwise a
misleading "relation not found" error will be reported rather than a
"join cannot be locked" error.

Backpatch all the way, except for the second part which only goes back
to 14, where JOIN USING aliases were added.

Dean Rasheed, reviewed by Tom Lane.

Discussion: https://postgr.es/m/CAEZATCUY_KOBnqxbTSPf=7fz9HWPnZ5Xgb9SwYzZ8rFXe7nb=w@mail.gmail.com

Branch
------
REL_14_STABLE

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

Modified Files
--------------
src/backend/parser/analyze.c       | 19 ++++++++++++++++++-
src/test/regress/expected/join.out | 33 +++++++++++++++++++++++++++++++++
src/test/regress/sql/join.sql      | 22 ++++++++++++++++++++++
3 files changed, 73 insertions(+), 1 deletion(-)



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

* pgsql: Fix alias matching in transformLockingClause().
@ 2022-07-07 12:14 Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 7+ messages in thread

From: Dean Rasheed @ 2022-07-07 12:14 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix alias matching in transformLockingClause().

When locking a specific named relation for a FOR [KEY] UPDATE/SHARE
clause, transformLockingClause() finds the relation to lock by
scanning the rangetable for an RTE with a matching eref->aliasname.
However, it failed to account for the visibility rules of a join RTE.

If a join RTE doesn't have a user-supplied alias, it will have a
generated eref->aliasname of "unnamed_join" that is not visible as a
relation name in the parse namespace. Such an RTE needs to be skipped,
otherwise it might be found in preference to a regular base relation
with a user-supplied alias of "unnamed_join", preventing it from being
locked.

In addition, if a join RTE doesn't have a user-supplied alias, but
does have a join_using_alias, then the RTE needs to be matched using
that alias rather than the generated eref->aliasname, otherwise a
misleading "relation not found" error will be reported rather than a
"join cannot be locked" error.

Backpatch all the way, except for the second part which only goes back
to 14, where JOIN USING aliases were added.

Dean Rasheed, reviewed by Tom Lane.

Discussion: https://postgr.es/m/CAEZATCUY_KOBnqxbTSPf=7fz9HWPnZ5Xgb9SwYzZ8rFXe7nb=w@mail.gmail.com

Branch
------
REL_13_STABLE

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

Modified Files
--------------
src/backend/parser/analyze.c       | 9 +++++++++
src/test/regress/expected/join.out | 8 ++++++++
src/test/regress/sql/join.sql      | 6 ++++++
3 files changed, 23 insertions(+)



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

* pgsql: Fix alias matching in transformLockingClause().
@ 2022-07-07 12:14 Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 7+ messages in thread

From: Dean Rasheed @ 2022-07-07 12:14 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix alias matching in transformLockingClause().

When locking a specific named relation for a FOR [KEY] UPDATE/SHARE
clause, transformLockingClause() finds the relation to lock by
scanning the rangetable for an RTE with a matching eref->aliasname.
However, it failed to account for the visibility rules of a join RTE.

If a join RTE doesn't have a user-supplied alias, it will have a
generated eref->aliasname of "unnamed_join" that is not visible as a
relation name in the parse namespace. Such an RTE needs to be skipped,
otherwise it might be found in preference to a regular base relation
with a user-supplied alias of "unnamed_join", preventing it from being
locked.

In addition, if a join RTE doesn't have a user-supplied alias, but
does have a join_using_alias, then the RTE needs to be matched using
that alias rather than the generated eref->aliasname, otherwise a
misleading "relation not found" error will be reported rather than a
"join cannot be locked" error.

Backpatch all the way, except for the second part which only goes back
to 14, where JOIN USING aliases were added.

Dean Rasheed, reviewed by Tom Lane.

Discussion: https://postgr.es/m/CAEZATCUY_KOBnqxbTSPf=7fz9HWPnZ5Xgb9SwYzZ8rFXe7nb=w@mail.gmail.com

Branch
------
REL_12_STABLE

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

Modified Files
--------------
src/backend/parser/analyze.c       | 9 +++++++++
src/test/regress/expected/join.out | 8 ++++++++
src/test/regress/sql/join.sql      | 6 ++++++
3 files changed, 23 insertions(+)



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

* pgsql: Fix alias matching in transformLockingClause().
@ 2022-07-07 12:14 Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 7+ messages in thread

From: Dean Rasheed @ 2022-07-07 12:14 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix alias matching in transformLockingClause().

When locking a specific named relation for a FOR [KEY] UPDATE/SHARE
clause, transformLockingClause() finds the relation to lock by
scanning the rangetable for an RTE with a matching eref->aliasname.
However, it failed to account for the visibility rules of a join RTE.

If a join RTE doesn't have a user-supplied alias, it will have a
generated eref->aliasname of "unnamed_join" that is not visible as a
relation name in the parse namespace. Such an RTE needs to be skipped,
otherwise it might be found in preference to a regular base relation
with a user-supplied alias of "unnamed_join", preventing it from being
locked.

In addition, if a join RTE doesn't have a user-supplied alias, but
does have a join_using_alias, then the RTE needs to be matched using
that alias rather than the generated eref->aliasname, otherwise a
misleading "relation not found" error will be reported rather than a
"join cannot be locked" error.

Backpatch all the way, except for the second part which only goes back
to 14, where JOIN USING aliases were added.

Dean Rasheed, reviewed by Tom Lane.

Discussion: https://postgr.es/m/CAEZATCUY_KOBnqxbTSPf=7fz9HWPnZ5Xgb9SwYzZ8rFXe7nb=w@mail.gmail.com

Branch
------
REL_11_STABLE

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

Modified Files
--------------
src/backend/parser/analyze.c       | 9 +++++++++
src/test/regress/expected/join.out | 8 ++++++++
src/test/regress/sql/join.sql      | 6 ++++++
3 files changed, 23 insertions(+)



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

* pgsql: Fix alias matching in transformLockingClause().
@ 2022-07-07 12:14 Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 7+ messages in thread

From: Dean Rasheed @ 2022-07-07 12:14 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix alias matching in transformLockingClause().

When locking a specific named relation for a FOR [KEY] UPDATE/SHARE
clause, transformLockingClause() finds the relation to lock by
scanning the rangetable for an RTE with a matching eref->aliasname.
However, it failed to account for the visibility rules of a join RTE.

If a join RTE doesn't have a user-supplied alias, it will have a
generated eref->aliasname of "unnamed_join" that is not visible as a
relation name in the parse namespace. Such an RTE needs to be skipped,
otherwise it might be found in preference to a regular base relation
with a user-supplied alias of "unnamed_join", preventing it from being
locked.

In addition, if a join RTE doesn't have a user-supplied alias, but
does have a join_using_alias, then the RTE needs to be matched using
that alias rather than the generated eref->aliasname, otherwise a
misleading "relation not found" error will be reported rather than a
"join cannot be locked" error.

Backpatch all the way, except for the second part which only goes back
to 14, where JOIN USING aliases were added.

Dean Rasheed, reviewed by Tom Lane.

Discussion: https://postgr.es/m/CAEZATCUY_KOBnqxbTSPf=7fz9HWPnZ5Xgb9SwYzZ8rFXe7nb=w@mail.gmail.com

Branch
------
REL_10_STABLE

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

Modified Files
--------------
src/backend/parser/analyze.c       | 9 +++++++++
src/test/regress/expected/join.out | 8 ++++++++
src/test/regress/sql/join.sql      | 6 ++++++
3 files changed, 23 insertions(+)



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


end of thread, other threads:[~2022-07-07 12:14 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-07-07 12:14 pgsql: Fix alias matching in transformLockingClause(). Dean Rasheed <dean.a.rasheed@gmail.com>
2022-07-07 12:14 pgsql: Fix alias matching in transformLockingClause(). Dean Rasheed <dean.a.rasheed@gmail.com>
2022-07-07 12:14 pgsql: Fix alias matching in transformLockingClause(). Dean Rasheed <dean.a.rasheed@gmail.com>
2022-07-07 12:14 pgsql: Fix alias matching in transformLockingClause(). Dean Rasheed <dean.a.rasheed@gmail.com>
2022-07-07 12:14 pgsql: Fix alias matching in transformLockingClause(). Dean Rasheed <dean.a.rasheed@gmail.com>
2022-07-07 12:14 pgsql: Fix alias matching in transformLockingClause(). Dean Rasheed <dean.a.rasheed@gmail.com>
2022-07-07 12:14 pgsql: Fix alias matching in transformLockingClause(). 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