postgresql/src/include/nodes
Tom Lane f7f83a55bf Ensure that expandTableLikeClause() re-examines the same table.
As it stood, expandTableLikeClause() re-did the same relation_openrv
call that transformTableLikeClause() had done.  However there are
scenarios where this would not find the same table as expected.
We hold lock on the LIKE source table, so it can't be renamed or
dropped, but another table could appear before it in the search path.
This explains the odd behavior reported in bug #16758 when cloning a
table as a temp table of the same name.  This case worked as expected
before commit 502898192 introduced the need to open the source table
twice, so we should fix it.

To make really sure we get the same table, let's re-open it by OID not
name.  That requires adding an OID field to struct TableLikeClause,
which is a little nervous-making from an ABI standpoint, but as long
as it's at the end I don't think there's any serious risk.

Per bug #16758 from Marc Boeren.  Like the previous patch,
back-patch to all supported branches.

Discussion: https://postgr.es/m/16758-840e84a6cfab276d@postgresql.org
2020-12-01 14:02:27 -05:00
..
bitmapset.h Move bitmap_hash and bitmap_match to bitmapset.c. 2020-02-24 17:17:43 +05:30
execnodes.h Move per-agg and per-trans duplicate finding to the planner. 2020-11-24 10:45:00 +02:00
extensible.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
lockoptions.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
makefuncs.h Improve our ability to regurgitate SQL-syntax function calls. 2020-11-04 12:34:50 -05:00
memnodes.h Revert "Specialize MemoryContextMemAllocated()." 2020-03-19 12:21:50 -07:00
nodeFuncs.h Suppress unnecessary RelabelType nodes in yet more cases. 2020-08-19 14:07:49 -04:00
nodes.h Move per-agg and per-trans duplicate finding to the planner. 2020-11-24 10:45:00 +02:00
params.h Initial pgindent and pgperltidy run for v13. 2020-05-14 13:06:50 -04:00
parsenodes.h Ensure that expandTableLikeClause() re-examines the same table. 2020-12-01 14:02:27 -05:00
pathnodes.h Fix missing outfuncs.c support for IncrementalSortPath. 2020-11-30 16:33:09 -05:00
pg_list.h Add pg_nodiscard decorations to some functions 2020-11-11 11:00:27 +01:00
plannodes.h Include result relation info in direct modify ForeignScan nodes. 2020-10-14 10:58:38 +03:00
primnodes.h Move per-agg and per-trans duplicate finding to the planner. 2020-11-24 10:45:00 +02:00
print.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
readfuncs.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
replnodes.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
supportnodes.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
tidbitmap.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
value.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00