Fix an error raised when dropping pg_ivm extension
Previously, DROP EXTENSION pg_ivm failed due to the failure of opening the index on pg_ivm_immv in PgIvmObjectAccessHook that is called on dropping pg_ivm_immv, because when pg_ivm_immv is being dropped, the index on it is already dropped. This is fixed to return immediately from the hook function if the dropped table is pg_ivm_immv.
This commit is contained in:
parent
8f5bb5300a
commit
d67995c0ab
1 changed files with 10 additions and 1 deletions
9
pg_ivm.c
9
pg_ivm.c
|
|
@ -391,9 +391,18 @@ PgIvmObjectAccessHook(ObjectAccessType access, Oid classId,
|
||||||
HeapTuple tup;
|
HeapTuple tup;
|
||||||
Oid pgIvmImmvOid = PgIvmImmvRelationId();
|
Oid pgIvmImmvOid = PgIvmImmvRelationId();
|
||||||
|
|
||||||
|
/* pg_ivm_immv is not created yet, so there are no IMMVs, either. */
|
||||||
if (pgIvmImmvOid == InvalidOid)
|
if (pgIvmImmvOid == InvalidOid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* When the dropped table is pg_ivm_immv, we don't need to continue
|
||||||
|
* any more. Also, in this case, the index on it is already dropped,
|
||||||
|
* so the index scan below will fail and raise an error.
|
||||||
|
*/
|
||||||
|
if (objectId == pgIvmImmOid)
|
||||||
|
return;
|
||||||
|
|
||||||
pgIvmImmv = table_open(pgIvmImmvOid, AccessShareLock);
|
pgIvmImmv = table_open(pgIvmImmvOid, AccessShareLock);
|
||||||
ScanKeyInit(&key,
|
ScanKeyInit(&key,
|
||||||
Anum_pg_ivm_immv_immvrelid,
|
Anum_pg_ivm_immv_immvrelid,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue