mirror of
https://github.com/postgres/postgres.git
synced 2025-11-21 00:42:43 +03:00
Fix transition tables for partition/inheritance.
We disallow row-level triggers with transition tables on child tables. Transition tables for triggers on the parent table contain only those columns present in the parent. (We can't mix tuple formats in a single transition table.) Patch by Thomas Munro Discussion: https://postgr.es/m/CA%2BTgmoZzTBBAsEUh4MazAN7ga%3D8SsMC-Knp-6cetts9yNZUCcg%40mail.gmail.com
This commit is contained in:
@@ -273,6 +273,30 @@ has_subclass(Oid relationId)
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* has_superclass - does this relation inherit from another? The caller
|
||||
* should hold a lock on the given relation so that it can't be concurrently
|
||||
* added to or removed from an inheritance hierarchy.
|
||||
*/
|
||||
bool
|
||||
has_superclass(Oid relationId)
|
||||
{
|
||||
Relation catalog;
|
||||
SysScanDesc scan;
|
||||
ScanKeyData skey;
|
||||
bool result;
|
||||
|
||||
catalog = heap_open(InheritsRelationId, AccessShareLock);
|
||||
ScanKeyInit(&skey, Anum_pg_inherits_inhrelid, BTEqualStrategyNumber,
|
||||
F_OIDEQ, ObjectIdGetDatum(relationId));
|
||||
scan = systable_beginscan(catalog, InheritsRelidSeqnoIndexId, true,
|
||||
NULL, 1, &skey);
|
||||
result = HeapTupleIsValid(systable_getnext(scan));
|
||||
systable_endscan(scan);
|
||||
heap_close(catalog, AccessShareLock);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Given two type OIDs, determine whether the first is a complex type
|
||||
|
||||
Reference in New Issue
Block a user