mirror of
https://github.com/postgres/postgres.git
synced 2025-06-17 17:02:08 +03:00
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.
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user