pgsql: Use the properly transformed RangeVar for expandTableLikeClause(

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Use the properly transformed RangeVar for expandTableLikeClause(
Date: 2020-09-13 16:52:12
Message-ID: E1kHVEa-0004h7-Nc@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Use the properly transformed RangeVar for expandTableLikeClause().

transformCreateStmt() adjusts the transformed statement's RangeVar
to specify the target schema explicitly, for the express reason
of making sure that auxiliary statements derived by parse
transformation operate on the right table. But the refactoring
I did in commit 502898192 got this wrong and passed the untransformed
RangeVar to expandTableLikeClause(). This could lead to assertion
failures or weird misbehavior if the wrong table was accessed.

Per report from Alexander Lakhin. Like the previous patch, back-patch
to all supported branches.

Discussion: https://postgr.es/m/05051f9d-b32b-cb35-6735-0e9f2ab86b5f@gmail.com

Branch
------
REL9_6_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/1a9c93ec3b9ae2766b60e97957d07028e2828796

Modified Files
--------------
src/backend/tcop/utility.c | 23 +++++++++++++++++------
src/test/regress/expected/create_table_like.out | 16 ++++++++++++++++
src/test/regress/sql/create_table_like.sql | 5 +++++
3 files changed, 38 insertions(+), 6 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2020-09-14 01:44:44 pgsql: Avoid useless allocations for information of dumpable objects in
Previous Message Peter Eisentraut 2020-09-12 18:36:29 pgsql: doc: Don't hide the "Up" link when it is the same as "Home"