postgresql/src/backend
Tom Lane e27453bd83 Fix ALTER COLUMN TYPE to not open a relation without any lock.
If the column being modified is referenced by a foreign key constraint
of another table, ALTER TABLE would open the other table (to re-parse
the constraint's definition) without having first obtained a lock on it.
This was evidently intentional, but that doesn't mean it's really safe.
It's especially not safe in 9.3, which pre-dates use of MVCC scans for
catalog reads, but even in current releases it doesn't seem like a good
idea.

We know we'll need AccessExclusiveLock shortly to drop the obsoleted
constraint, so just get that a little sooner to close the hole.

Per testing with a patch that complains if we open a relation without
holding any lock on it.  I don't plan to back-patch that patch, but we
should close the holes it identifies in all supported branches.

Discussion: https://postgr.es/m/2038.1538335244@sss.pgh.pa.us
2018-10-01 11:39:13 -04:00
..
access Fix assertion failure when updating full_page_writes for checkpointer. 2018-09-28 16:40:04 +05:30
bootstrap Install a check for mis-linking of src/port and src/common functions. 2018-09-09 12:23:23 -04:00
catalog Create an RTE field to record the query's lock mode for each relation. 2018-09-30 13:55:51 -04:00
commands Fix ALTER COLUMN TYPE to not open a relation without any lock. 2018-10-01 11:39:13 -04:00
executor Create an RTE field to record the query's lock mode for each relation. 2018-09-30 13:55:51 -04:00
foreign Remove bogus "extern" annotations on function definitions. 2018-02-19 12:07:44 -05:00
jit Change TupleTableSlot->tts_nvalid to type AttrNumber. 2018-09-25 15:59:46 -07:00
lib Implement %m in src/port/snprintf.c, and teach elog.c to rely on that. 2018-09-26 13:31:56 -04:00
libpq Minor cleanup/future-proofing for pg_saslprep(). 2018-09-08 18:20:36 -04:00
main Update copyright for 2018 2018-01-02 23:30:12 -05:00
nodes Create an RTE field to record the query's lock mode for each relation. 2018-09-30 13:55:51 -04:00
optimizer Create an RTE field to record the query's lock mode for each relation. 2018-09-30 13:55:51 -04:00
parser Create an RTE field to record the query's lock mode for each relation. 2018-09-30 13:55:51 -04:00
partitioning Split ExecStoreTuple into ExecStoreHeapTuple and ExecStoreBufferHeapTuple. 2018-09-25 16:27:48 -07:00
po Translation updates 2018-06-25 12:37:18 +02:00
port Convert elog.c's useful_strerror() into a globally-used strerror wrapper. 2018-09-26 11:06:42 -04:00
postmaster Add application_name to connection authorized msg 2018-09-28 19:04:50 -04:00
regex Clean up warnings from -Wimplicit-fallthrough. 2018-05-01 19:35:08 -04:00
replication Create an RTE field to record the query's lock mode for each relation. 2018-09-30 13:55:51 -04:00
rewrite Create an RTE field to record the query's lock mode for each relation. 2018-09-30 13:55:51 -04:00
snowball Sync our Snowball stemmer dictionaries with current upstream. 2018-09-24 17:29:38 -04:00
statistics Fix typos. 2018-08-27 09:32:59 +12:00
storage Replace CAS loop with single TAS in ProcArrayGroupClearXid() 2018-09-22 16:22:30 +03:00
tcop Add a debugging option to stress-test outfuncs.c and readfuncs.c. 2018-09-18 17:11:54 -04:00
tsearch Hand code string to integer conversion for performance. 2018-07-22 14:58:23 -07:00
utils Create an RTE field to record the query's lock mode for each relation. 2018-09-30 13:55:51 -04:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
Makefile Refactor dlopen() support 2018-09-06 11:33:04 +02:00
nls.mk Translation updates 2018-06-25 12:37:18 +02:00