@ -1041,7 +1041,7 @@ DefineRelation(CreateStmt *stmt, char relkind, Oid ownerId,
*/
*/
defaultPartOid =
defaultPartOid =
get_default_oid_from_partdesc ( RelationGetPartitionDesc ( parent ,
get_default_oid_from_partdesc ( RelationGetPartitionDesc ( parent ,
fals e) ) ;
tru e) ) ;
if ( OidIsValid ( defaultPartOid ) )
if ( OidIsValid ( defaultPartOid ) )
defaultRel = table_open ( defaultPartOid , AccessExclusiveLock ) ;
defaultRel = table_open ( defaultPartOid , AccessExclusiveLock ) ;
@ -3507,7 +3507,7 @@ renameatt_internal(Oid myrelid,
* expected_parents will only be 0 if we are not already recursing .
* expected_parents will only be 0 if we are not already recursing .
*/
*/
if ( expected_parents = = 0 & &
if ( expected_parents = = 0 & &
find_inheritance_children ( myrelid , fals e, NoLock ) ! = NIL )
find_inheritance_children ( myrelid , tru e, NoLock , NULL ) ! = NIL )
ereport ( ERROR ,
ereport ( ERROR ,
( errcode ( ERRCODE_INVALID_TABLE_DEFINITION ) ,
( errcode ( ERRCODE_INVALID_TABLE_DEFINITION ) ,
errmsg ( " inherited column \" %s \" must be renamed in child tables too " ,
errmsg ( " inherited column \" %s \" must be renamed in child tables too " ,
@ -3706,7 +3706,7 @@ rename_constraint_internal(Oid myrelid,
else
else
{
{
if ( expected_parents = = 0 & &
if ( expected_parents = = 0 & &
find_inheritance_children ( myrelid , fals e, NoLock ) ! = NIL )
find_inheritance_children ( myrelid , tru e, NoLock , NULL ) ! = NIL )
ereport ( ERROR ,
ereport ( ERROR ,
( errcode ( ERRCODE_INVALID_TABLE_DEFINITION ) ,
( errcode ( ERRCODE_INVALID_TABLE_DEFINITION ) ,
errmsg ( " inherited constraint \" %s \" must be renamed in child tables too " ,
errmsg ( " inherited constraint \" %s \" must be renamed in child tables too " ,
@ -6580,7 +6580,7 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel,
*/
*/
if ( colDef - > identity & &
if ( colDef - > identity & &
recurse & &
recurse & &
find_inheritance_children ( myrelid , fals e, NoLock ) ! = NIL )
find_inheritance_children ( myrelid , tru e, NoLock , NULL ) ! = NIL )
ereport ( ERROR ,
ereport ( ERROR ,
( errcode ( ERRCODE_INVALID_TABLE_DEFINITION ) ,
( errcode ( ERRCODE_INVALID_TABLE_DEFINITION ) ,
errmsg ( " cannot recursively add identity column to table that has child tables " ) ) ) ;
errmsg ( " cannot recursively add identity column to table that has child tables " ) ) ) ;
@ -6826,7 +6826,7 @@ ATExecAddColumn(List **wqueue, AlteredTableInfo *tab, Relation rel,
* use find_all_inheritors to do it in one pass .
* use find_all_inheritors to do it in one pass .
*/
*/
children =
children =
find_inheritance_children ( RelationGetRelid ( rel ) , fals e, lockmode ) ;
find_inheritance_children ( RelationGetRelid ( rel ) , tru e, lockmode , NULL ) ;
/*
/*
* If we are told not to recurse , there had better not be any child
* If we are told not to recurse , there had better not be any child
@ -6980,7 +6980,7 @@ ATPrepDropNotNull(Relation rel, bool recurse, bool recursing)
*/
*/
if ( rel - > rd_rel - > relkind = = RELKIND_PARTITIONED_TABLE )
if ( rel - > rd_rel - > relkind = = RELKIND_PARTITIONED_TABLE )
{
{
PartitionDesc partdesc = RelationGetPartitionDesc ( rel , fals e) ;
PartitionDesc partdesc = RelationGetPartitionDesc ( rel , tru e) ;
Assert ( partdesc ! = NULL ) ;
Assert ( partdesc ! = NULL ) ;
if ( partdesc - > nparts > 0 & & ! recurse & & ! recursing )
if ( partdesc - > nparts > 0 & & ! recurse & & ! recursing )
@ -7689,7 +7689,7 @@ ATPrepDropExpression(Relation rel, AlterTableCmd *cmd, bool recurse, bool recurs
* resulting state can be properly dumped and restored .
* resulting state can be properly dumped and restored .
*/
*/
if ( ! recurse & &
if ( ! recurse & &
find_inheritance_children ( RelationGetRelid ( rel ) , fals e, lockmode ) )
find_inheritance_children ( RelationGetRelid ( rel ) , tru e, lockmode , NULL ) )
ereport ( ERROR ,
ereport ( ERROR ,
( errcode ( ERRCODE_FEATURE_NOT_SUPPORTED ) ,
( errcode ( ERRCODE_FEATURE_NOT_SUPPORTED ) ,
errmsg ( " ALTER TABLE / DROP EXPRESSION must be applied to child tables too " ) ) ) ;
errmsg ( " ALTER TABLE / DROP EXPRESSION must be applied to child tables too " ) ) ) ;
@ -8297,7 +8297,7 @@ ATExecDropColumn(List **wqueue, Relation rel, const char *colName,
* use find_all_inheritors to do it in one pass .
* use find_all_inheritors to do it in one pass .
*/
*/
children =
children =
find_inheritance_children ( RelationGetRelid ( rel ) , fals e, lockmode ) ;
find_inheritance_children ( RelationGetRelid ( rel ) , tru e, lockmode , NULL ) ;
if ( children )
if ( children )
{
{
@ -8785,7 +8785,7 @@ ATAddCheckConstraint(List **wqueue, AlteredTableInfo *tab, Relation rel,
* use find_all_inheritors to do it in one pass .
* use find_all_inheritors to do it in one pass .
*/
*/
children =
children =
find_inheritance_children ( RelationGetRelid ( rel ) , fals e, lockmode ) ;
find_inheritance_children ( RelationGetRelid ( rel ) , tru e, lockmode , NULL ) ;
/*
/*
* Check if ONLY was specified with ALTER TABLE . If so , allow the
* Check if ONLY was specified with ALTER TABLE . If so , allow the
@ -9400,7 +9400,7 @@ addFkRecurseReferenced(List **wqueue, Constraint *fkconstraint, Relation rel,
*/
*/
if ( pkrel - > rd_rel - > relkind = = RELKIND_PARTITIONED_TABLE )
if ( pkrel - > rd_rel - > relkind = = RELKIND_PARTITIONED_TABLE )
{
{
PartitionDesc pd = RelationGetPartitionDesc ( pkrel , fals e) ;
PartitionDesc pd = RelationGetPartitionDesc ( pkrel , tru e) ;
for ( int i = 0 ; i < pd - > nparts ; i + + )
for ( int i = 0 ; i < pd - > nparts ; i + + )
{
{
@ -9534,7 +9534,7 @@ addFkRecurseReferencing(List **wqueue, Constraint *fkconstraint, Relation rel,
}
}
else if ( rel - > rd_rel - > relkind = = RELKIND_PARTITIONED_TABLE )
else if ( rel - > rd_rel - > relkind = = RELKIND_PARTITIONED_TABLE )
{
{
PartitionDesc pd = RelationGetPartitionDesc ( rel , fals e) ;
PartitionDesc pd = RelationGetPartitionDesc ( rel , tru e) ;
/*
/*
* Recurse to take appropriate action on each partition ; either we
* Recurse to take appropriate action on each partition ; either we
@ -11318,8 +11318,8 @@ ATExecDropConstraint(Relation rel, const char *constrName,
* use find_all_inheritors to do it in one pass .
* use find_all_inheritors to do it in one pass .
*/
*/
if ( ! is_no_inherit_constraint )
if ( ! is_no_inherit_constraint )
children =
children = find_inheritance_children ( RelationGetRelid ( rel ) , true ,
find_inheritance_children ( RelationGetRelid ( rel ) , false , lockmode ) ;
lockmode , NULL ) ;
else
else
children = NIL ;
children = NIL ;
@ -11703,8 +11703,8 @@ ATPrepAlterColumnType(List **wqueue,
}
}
}
}
else if ( ! recursing & &
else if ( ! recursing & &
find_inheritance_children ( RelationGetRelid ( rel ) , fals e,
find_inheritance_children ( RelationGetRelid ( rel ) , tru e,
NoLock ) ! = NIL )
NoLock , NULL ) ! = NIL )
ereport ( ERROR ,
ereport ( ERROR ,
( errcode ( ERRCODE_INVALID_TABLE_DEFINITION ) ,
( errcode ( ERRCODE_INVALID_TABLE_DEFINITION ) ,
errmsg ( " type of inherited column \" %s \" must be changed in child tables too " ,
errmsg ( " type of inherited column \" %s \" must be changed in child tables too " ,
@ -16875,7 +16875,7 @@ QueuePartitionConstraintValidation(List **wqueue, Relation scanrel,
}
}
else if ( scanrel - > rd_rel - > relkind = = RELKIND_PARTITIONED_TABLE )
else if ( scanrel - > rd_rel - > relkind = = RELKIND_PARTITIONED_TABLE )
{
{
PartitionDesc partdesc = RelationGetPartitionDesc ( scanrel , fals e) ;
PartitionDesc partdesc = RelationGetPartitionDesc ( scanrel , tru e) ;
int i ;
int i ;
for ( i = 0 ; i < partdesc - > nparts ; i + + )
for ( i = 0 ; i < partdesc - > nparts ; i + + )
@ -16935,7 +16935,7 @@ ATExecAttachPartition(List **wqueue, Relation rel, PartitionCmd *cmd,
* new partition will change its partition constraint .
* new partition will change its partition constraint .
*/
*/
defaultPartOid =
defaultPartOid =
get_default_oid_from_partdesc ( RelationGetPartitionDesc ( rel , fals e) ) ;
get_default_oid_from_partdesc ( RelationGetPartitionDesc ( rel , tru e) ) ;
if ( OidIsValid ( defaultPartOid ) )
if ( OidIsValid ( defaultPartOid ) )
LockRelationOid ( defaultPartOid , AccessExclusiveLock ) ;
LockRelationOid ( defaultPartOid , AccessExclusiveLock ) ;
@ -17551,7 +17551,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
* will change its partition constraint .
* will change its partition constraint .
*/
*/
defaultPartOid =
defaultPartOid =
get_default_oid_from_partdesc ( RelationGetPartitionDesc ( rel , fals e) ) ;
get_default_oid_from_partdesc ( RelationGetPartitionDesc ( rel , tru e) ) ;
if ( OidIsValid ( defaultPartOid ) )
if ( OidIsValid ( defaultPartOid ) )
{
{
/*
/*
@ -18148,7 +18148,7 @@ ATExecAttachPartitionIdx(List **wqueue, Relation parentIdx, RangeVar *name)
RelationGetRelationName ( partIdx ) ) ) ) ;
RelationGetRelationName ( partIdx ) ) ) ) ;
/* Make sure it indexes a partition of the other index's table */
/* Make sure it indexes a partition of the other index's table */
partDesc = RelationGetPartitionDesc ( parentTbl , fals e) ;
partDesc = RelationGetPartitionDesc ( parentTbl , tru e) ;
found = false ;
found = false ;
for ( i = 0 ; i < partDesc - > nparts ; i + + )
for ( i = 0 ; i < partDesc - > nparts ; i + + )
{
{
@ -18302,7 +18302,7 @@ validatePartitionedIndex(Relation partedIdx, Relation partedTbl)
* If we found as many inherited indexes as the partitioned table has
* If we found as many inherited indexes as the partitioned table has
* partitions , we ' re good ; update pg_index to set indisvalid .
* partitions , we ' re good ; update pg_index to set indisvalid .
*/
*/
if ( tuples = = RelationGetPartitionDesc ( partedTbl , fals e) - > nparts )
if ( tuples = = RelationGetPartitionDesc ( partedTbl , tru e) - > nparts )
{
{
Relation idxRel ;
Relation idxRel ;
HeapTuple newtup ;
HeapTuple newtup ;