postgresql/src/include
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
..
access Remove catalog function currtid() 2020-11-25 12:18:26 +09:00
bootstrap Update copyrights for 2020 2020-01-01 12:21:45 -05:00
catalog Remove catalog function currtid() 2020-11-25 12:18:26 +09:00
commands Fix a few comments that referred to copy.c. 2020-11-23 11:36:13 +02:00
common Improve performance of Unicode {de,re}composition in the backend 2020-10-23 11:05:46 +09:00
datatype Update copyrights for 2020 2020-01-01 12:21:45 -05:00
executor Move per-agg and per-trans duplicate finding to the planner. 2020-11-24 10:45:00 +02:00
fe_utils Move connect.h from fe_utils to src/include/common. 2020-08-10 09:22:54 -07:00
foreign Update copyrights for 2020 2020-01-01 12:21:45 -05:00
jit llvmjit: Work around bug in LLVM 3.9 causing crashes after 72559438f9. 2020-10-15 18:17:00 -07:00
lib Correct comment in simplehash.h. 2020-08-03 12:23:05 +12:00
libpq Add support for abstract Unix-domain sockets 2020-11-25 08:33:57 +01:00
mb Allow Unicode escapes in any server encoding, not only UTF-8. 2020-03-06 14:17:43 -05:00
nodes Ensure that expandTableLikeClause() re-examines the same table. 2020-12-01 14:02:27 -05:00
optimizer Fix missing outfuncs.c support for IncrementalSortPath. 2020-11-30 16:33:09 -05:00
parser Calculate extraUpdatedCols in query rewriter, not parser. 2020-10-28 13:47:02 -04:00
partitioning Improve error cursor positions for problems with partition bounds. 2020-09-23 18:04:53 -04:00
port Use https for gnu.org links 2020-10-14 08:24:54 +02:00
portability Update copyrights for 2020 2020-01-01 12:21:45 -05:00
postmaster Trigger autovacuum based on number of INSERTs 2020-03-28 19:20:12 +13:00
regex Assume that we have <wchar.h>. 2020-02-21 14:30:47 -05:00
replication Fix 'skip-empty-xacts' option in test_decoding for streaming mode. 2020-11-17 12:14:53 +05:30
rewrite Calculate extraUpdatedCols in query rewriter, not parser. 2020-10-28 13:47:02 -04:00
snowball Update snowball 2020-06-08 08:07:15 +02:00
statistics Initial pgindent and pgperltidy run for v13. 2020-05-14 13:06:50 -04:00
storage Use truncate(2) where appropriate. 2020-12-01 15:42:22 +13:00
tcop Fix bogus completion tag usage in walsender 2020-09-16 21:16:25 -03:00
tsearch Improve behavior of tsearch_readline(), and remove t_readline(). 2020-09-23 20:26:58 -04:00
utils Avoid spamming the client with multiple ParameterStatus messages. 2020-11-25 11:40:44 -05:00
.gitignore Refactor dlopen() support 2018-09-06 11:33:04 +02:00
c.h Stop gap fix for __attribute__((cold)) compiler bug in MinGW 8.1 2020-11-25 16:33:43 +13:00
fmgr.h Use PG_GETARG_TRANSACTIONID where appropriate 2020-11-02 16:48:22 +01:00
funcapi.h Support for OUT parameters in procedures 2020-10-05 09:21:43 +02:00
getaddrinfo.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
getopt_long.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
Makefile Get rid of jsonpath_gram.h and jsonpath_scanner.h 2019-03-20 11:13:34 +03:00
miscadmin.h Add hash_mem_multiplier GUC. 2020-07-29 14:14:58 -07:00
pg_config.h.in Remove ability to independently select random number generator 2020-11-20 13:57:33 +01:00
pg_config_ext.h.in Autoconfiscate selection of 64-bit int type for 64-bit large object API. 2012-10-07 21:52:43 -04:00
pg_config_manual.h Add nbtree Valgrind buffer lock checks. 2020-07-21 15:50:58 -07:00
pg_getopt.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
pg_trace.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
pgstat.h Track statistics for streaming of changes from ReorderBuffer. 2020-10-29 09:11:51 +05:30
pgtar.h Assorted cleanup of tar-related code. 2020-06-15 15:28:49 -04:00
pgtime.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
port.h Add pg_strong_random_init function to initialize random number generator 2020-11-06 13:21:28 +01:00
postgres.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
postgres_ext.h Phase 2 of pgindent updates. 2017-06-21 15:19:25 -04:00
postgres_fe.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
rusagestub.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00
windowapi.h Update copyrights for 2020 2020-01-01 12:21:45 -05:00