diff options
author | Michael Paquier <michael@paquier.xyz> | 2018-12-17 12:43:00 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2018-12-17 12:43:00 +0900 |
commit | 67915fb8e51692ae92622696ad03e933be224bf2 (patch) | |
tree | 0bd1c15c7c190f029a43cc368af1ff697832c716 /src/backend/commands/tablecmds.c | |
parent | b13fd344c5fce6a2f95b758e97b79eb00adf2731 (diff) | |
download | postgresql-67915fb8e51692ae92622696ad03e933be224bf2.tar.gz postgresql-67915fb8e51692ae92622696ad03e933be224bf2.zip |
Fix use-after-free bug when renaming constraints
This is an oversight from recent commit b13fd344. While on it, tweak
the previous test with a better name for the renamed primary key.
Detected by buildfarm member prion which forces relation cache release
with -DRELCACHE_FORCE_RELEASE. Back-patch down to 9.4 as the previous
commit.
Diffstat (limited to 'src/backend/commands/tablecmds.c')
-rw-r--r-- | src/backend/commands/tablecmds.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index fe75f9e80bb..9149dfd3285 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -3020,12 +3020,12 @@ rename_constraint_internal(Oid myrelid, if (targetrelation) { - relation_close(targetrelation, NoLock); /* close rel but keep lock */ - /* * Invalidate relcache so as others can see the new constraint name. */ CacheInvalidateRelcache(targetrelation); + + relation_close(targetrelation, NoLock); /* close rel but keep lock */ } return address; |