pgsql: Use the properly transformed RangeVar for expandTableLikeClause(

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

pgsql: Use the properly transformed RangeVar for expandTableLikeClause(

Tom Lane-2
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@...

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/1371a1e4161a25a128b666109ac5a9d449da982a

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