mirror of
https://github.com/postgres/postgres.git
synced 2025-05-05 09:19:17 +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:
parent
25b8094d33
commit
e83e0988dc
@ -3027,12 +3027,12 @@ rename_constraint_internal(Oid myrelid,
|
|||||||
|
|
||||||
if (targetrelation)
|
if (targetrelation)
|
||||||
{
|
{
|
||||||
relation_close(targetrelation, NoLock); /* close rel but keep lock */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Invalidate relcache so as others can see the new constraint name.
|
* Invalidate relcache so as others can see the new constraint name.
|
||||||
*/
|
*/
|
||||||
CacheInvalidateRelcache(targetrelation);
|
CacheInvalidateRelcache(targetrelation);
|
||||||
|
|
||||||
|
relation_close(targetrelation, NoLock); /* close rel but keep lock */
|
||||||
}
|
}
|
||||||
|
|
||||||
return address;
|
return address;
|
||||||
|
@ -406,7 +406,7 @@ CREATE TABLE constraint_rename_cache (a int,
|
|||||||
ALTER TABLE constraint_rename_cache
|
ALTER TABLE constraint_rename_cache
|
||||||
RENAME CONSTRAINT chk_a TO chk_a_new;
|
RENAME CONSTRAINT chk_a TO chk_a_new;
|
||||||
ALTER TABLE constraint_rename_cache
|
ALTER TABLE constraint_rename_cache
|
||||||
RENAME CONSTRAINT constraint_rename_cache_pkey TO chk_a_gt_zero;
|
RENAME CONSTRAINT constraint_rename_cache_pkey TO constraint_rename_pkey_new;
|
||||||
CREATE TABLE like_constraint_rename_cache
|
CREATE TABLE like_constraint_rename_cache
|
||||||
(LIKE constraint_rename_cache INCLUDING ALL);
|
(LIKE constraint_rename_cache INCLUDING ALL);
|
||||||
\d like_constraint_rename_cache
|
\d like_constraint_rename_cache
|
||||||
|
@ -308,7 +308,7 @@ CREATE TABLE constraint_rename_cache (a int,
|
|||||||
ALTER TABLE constraint_rename_cache
|
ALTER TABLE constraint_rename_cache
|
||||||
RENAME CONSTRAINT chk_a TO chk_a_new;
|
RENAME CONSTRAINT chk_a TO chk_a_new;
|
||||||
ALTER TABLE constraint_rename_cache
|
ALTER TABLE constraint_rename_cache
|
||||||
RENAME CONSTRAINT constraint_rename_cache_pkey TO chk_a_gt_zero;
|
RENAME CONSTRAINT constraint_rename_cache_pkey TO constraint_rename_pkey_new;
|
||||||
CREATE TABLE like_constraint_rename_cache
|
CREATE TABLE like_constraint_rename_cache
|
||||||
(LIKE constraint_rename_cache INCLUDING ALL);
|
(LIKE constraint_rename_cache INCLUDING ALL);
|
||||||
\d like_constraint_rename_cache
|
\d like_constraint_rename_cache
|
||||||
|
Loading…
x
Reference in New Issue
Block a user