@ -144,60 +144,6 @@ typedef struct
List * rtables ; /* list of rangetables to resolve Vars */
List * rtables ; /* list of rangetables to resolve Vars */
} find_expr_references_context ;
} find_expr_references_context ;
/*
* This constant table maps ObjectClasses to the corresponding catalog OIDs .
* See also getObjectClass ( ) .
*/
static const Oid object_classes [ ] = {
RelationRelationId , /* OCLASS_CLASS */
ProcedureRelationId , /* OCLASS_PROC */
TypeRelationId , /* OCLASS_TYPE */
CastRelationId , /* OCLASS_CAST */
CollationRelationId , /* OCLASS_COLLATION */
ConstraintRelationId , /* OCLASS_CONSTRAINT */
ConversionRelationId , /* OCLASS_CONVERSION */
AttrDefaultRelationId , /* OCLASS_DEFAULT */
LanguageRelationId , /* OCLASS_LANGUAGE */
LargeObjectRelationId , /* OCLASS_LARGEOBJECT */
OperatorRelationId , /* OCLASS_OPERATOR */
OperatorClassRelationId , /* OCLASS_OPCLASS */
OperatorFamilyRelationId , /* OCLASS_OPFAMILY */
AccessMethodRelationId , /* OCLASS_AM */
AccessMethodOperatorRelationId , /* OCLASS_AMOP */
AccessMethodProcedureRelationId , /* OCLASS_AMPROC */
RewriteRelationId , /* OCLASS_REWRITE */
TriggerRelationId , /* OCLASS_TRIGGER */
NamespaceRelationId , /* OCLASS_SCHEMA */
StatisticExtRelationId , /* OCLASS_STATISTIC_EXT */
TSParserRelationId , /* OCLASS_TSPARSER */
TSDictionaryRelationId , /* OCLASS_TSDICT */
TSTemplateRelationId , /* OCLASS_TSTEMPLATE */
TSConfigRelationId , /* OCLASS_TSCONFIG */
AuthIdRelationId , /* OCLASS_ROLE */
AuthMemRelationId , /* OCLASS_ROLE_MEMBERSHIP */
DatabaseRelationId , /* OCLASS_DATABASE */
TableSpaceRelationId , /* OCLASS_TBLSPACE */
ForeignDataWrapperRelationId , /* OCLASS_FDW */
ForeignServerRelationId , /* OCLASS_FOREIGN_SERVER */
UserMappingRelationId , /* OCLASS_USER_MAPPING */
DefaultAclRelationId , /* OCLASS_DEFACL */
ExtensionRelationId , /* OCLASS_EXTENSION */
EventTriggerRelationId , /* OCLASS_EVENT_TRIGGER */
ParameterAclRelationId , /* OCLASS_PARAMETER_ACL */
PolicyRelationId , /* OCLASS_POLICY */
PublicationNamespaceRelationId , /* OCLASS_PUBLICATION_NAMESPACE */
PublicationRelationId , /* OCLASS_PUBLICATION */
PublicationRelRelationId , /* OCLASS_PUBLICATION_REL */
SubscriptionRelationId , /* OCLASS_SUBSCRIPTION */
TransformRelationId /* OCLASS_TRANSFORM */
} ;
/*
* Make sure object_classes is kept up to date with the ObjectClass enum .
*/
StaticAssertDecl ( lengthof ( object_classes ) = = LAST_OCLASS + 1 ,
" object_classes[] must cover all ObjectClasses " ) ;
static void findDependentObjects ( const ObjectAddress * object ,
static void findDependentObjects ( const ObjectAddress * object ,
int objflags ,
int objflags ,
@ -219,7 +165,7 @@ static void process_function_rte_ref(RangeTblEntry *rte, AttrNumber attnum,
find_expr_references_context * context ) ;
find_expr_references_context * context ) ;
static void eliminate_duplicate_dependencies ( ObjectAddresses * addrs ) ;
static void eliminate_duplicate_dependencies ( ObjectAddresses * addrs ) ;
static int object_address_comparator ( const void * a , const void * b ) ;
static int object_address_comparator ( const void * a , const void * b ) ;
static void add_object_address ( ObjectClass oclass , Oid objectId , int32 subId ,
static void add_object_address ( Oid classId , Oid objectId , int32 subId ,
ObjectAddresses * addrs ) ;
ObjectAddresses * addrs ) ;
static void add_exact_object_address_extra ( const ObjectAddress * object ,
static void add_exact_object_address_extra ( const ObjectAddress * object ,
const ObjectAddressExtra * extra ,
const ObjectAddressExtra * extra ,
@ -1786,7 +1732,7 @@ find_expr_references_walker(Node *node,
if ( rte - > rtekind = = RTE_RELATION )
if ( rte - > rtekind = = RTE_RELATION )
{
{
/* If it's a plain relation, reference this column */
/* If it's a plain relation, reference this column */
add_object_address ( OCLASS_CLASS , rte - > relid , var - > varattno ,
add_object_address ( RelationRelationId , rte - > relid , var - > varattno ,
context - > addrs ) ;
context - > addrs ) ;
}
}
else if ( rte - > rtekind = = RTE_FUNCTION )
else if ( rte - > rtekind = = RTE_FUNCTION )
@ -1812,7 +1758,7 @@ find_expr_references_walker(Node *node,
Oid objoid ;
Oid objoid ;
/* A constant must depend on the constant's datatype */
/* A constant must depend on the constant's datatype */
add_object_address ( OCLASS_TYPE , con - > consttype , 0 ,
add_object_address ( TypeRelationId , con - > consttype , 0 ,
context - > addrs ) ;
context - > addrs ) ;
/*
/*
@ -1823,7 +1769,7 @@ find_expr_references_walker(Node *node,
*/
*/
if ( OidIsValid ( con - > constcollid ) & &
if ( OidIsValid ( con - > constcollid ) & &
con - > constcollid ! = DEFAULT_COLLATION_OID )
con - > constcollid ! = DEFAULT_COLLATION_OID )
add_object_address ( OCLASS_COLLATION , con - > constcollid , 0 ,
add_object_address ( CollationRelationId , con - > constcollid , 0 ,
context - > addrs ) ;
context - > addrs ) ;
/*
/*
@ -1841,7 +1787,7 @@ find_expr_references_walker(Node *node,
objoid = DatumGetObjectId ( con - > constvalue ) ;
objoid = DatumGetObjectId ( con - > constvalue ) ;
if ( SearchSysCacheExists1 ( PROCOID ,
if ( SearchSysCacheExists1 ( PROCOID ,
ObjectIdGetDatum ( objoid ) ) )
ObjectIdGetDatum ( objoid ) ) )
add_object_address ( OCLASS_PROC , objoid , 0 ,
add_object_address ( ProcedureRelationId , objoid , 0 ,
context - > addrs ) ;
context - > addrs ) ;
break ;
break ;
case REGOPEROID :
case REGOPEROID :
@ -1849,42 +1795,42 @@ find_expr_references_walker(Node *node,
objoid = DatumGetObjectId ( con - > constvalue ) ;
objoid = DatumGetObjectId ( con - > constvalue ) ;
if ( SearchSysCacheExists1 ( OPEROID ,
if ( SearchSysCacheExists1 ( OPEROID ,
ObjectIdGetDatum ( objoid ) ) )
ObjectIdGetDatum ( objoid ) ) )
add_object_address ( OCLASS_OPERATOR , objoid , 0 ,
add_object_address ( OperatorRelationId , objoid , 0 ,
context - > addrs ) ;
context - > addrs ) ;
break ;
break ;
case REGCLASSOID :
case REGCLASSOID :
objoid = DatumGetObjectId ( con - > constvalue ) ;
objoid = DatumGetObjectId ( con - > constvalue ) ;
if ( SearchSysCacheExists1 ( RELOID ,
if ( SearchSysCacheExists1 ( RELOID ,
ObjectIdGetDatum ( objoid ) ) )
ObjectIdGetDatum ( objoid ) ) )
add_object_address ( OCLASS_CLASS , objoid , 0 ,
add_object_address ( RelationRelationId , objoid , 0 ,
context - > addrs ) ;
context - > addrs ) ;
break ;
break ;
case REGTYPEOID :
case REGTYPEOID :
objoid = DatumGetObjectId ( con - > constvalue ) ;
objoid = DatumGetObjectId ( con - > constvalue ) ;
if ( SearchSysCacheExists1 ( TYPEOID ,
if ( SearchSysCacheExists1 ( TYPEOID ,
ObjectIdGetDatum ( objoid ) ) )
ObjectIdGetDatum ( objoid ) ) )
add_object_address ( OCLASS_TYPE , objoid , 0 ,
add_object_address ( TypeRelationId , objoid , 0 ,
context - > addrs ) ;
context - > addrs ) ;
break ;
break ;
case REGCOLLATIONOID :
case REGCOLLATIONOID :
objoid = DatumGetObjectId ( con - > constvalue ) ;
objoid = DatumGetObjectId ( con - > constvalue ) ;
if ( SearchSysCacheExists1 ( COLLOID ,
if ( SearchSysCacheExists1 ( COLLOID ,
ObjectIdGetDatum ( objoid ) ) )
ObjectIdGetDatum ( objoid ) ) )
add_object_address ( OCLASS_COLLATION , objoid , 0 ,
add_object_address ( CollationRelationId , objoid , 0 ,
context - > addrs ) ;
context - > addrs ) ;
break ;
break ;
case REGCONFIGOID :
case REGCONFIGOID :
objoid = DatumGetObjectId ( con - > constvalue ) ;
objoid = DatumGetObjectId ( con - > constvalue ) ;
if ( SearchSysCacheExists1 ( TSCONFIGOID ,
if ( SearchSysCacheExists1 ( TSCONFIGOID ,
ObjectIdGetDatum ( objoid ) ) )
ObjectIdGetDatum ( objoid ) ) )
add_object_address ( OCLASS_TSCONFIG , objoid , 0 ,
add_object_address ( TSConfigRelationId , objoid , 0 ,
context - > addrs ) ;
context - > addrs ) ;
break ;
break ;
case REGDICTIONARYOID :
case REGDICTIONARYOID :
objoid = DatumGetObjectId ( con - > constvalue ) ;
objoid = DatumGetObjectId ( con - > constvalue ) ;
if ( SearchSysCacheExists1 ( TSDICTOID ,
if ( SearchSysCacheExists1 ( TSDICTOID ,
ObjectIdGetDatum ( objoid ) ) )
ObjectIdGetDatum ( objoid ) ) )
add_object_address ( OCLASS_TSDICT , objoid , 0 ,
add_object_address ( TSDictionaryRelationId , objoid , 0 ,
context - > addrs ) ;
context - > addrs ) ;
break ;
break ;
@ -1892,7 +1838,7 @@ find_expr_references_walker(Node *node,
objoid = DatumGetObjectId ( con - > constvalue ) ;
objoid = DatumGetObjectId ( con - > constvalue ) ;
if ( SearchSysCacheExists1 ( NAMESPACEOID ,
if ( SearchSysCacheExists1 ( NAMESPACEOID ,
ObjectIdGetDatum ( objoid ) ) )
ObjectIdGetDatum ( objoid ) ) )
add_object_address ( OCLASS_SCHEMA , objoid , 0 ,
add_object_address ( NamespaceRelationId , objoid , 0 ,
context - > addrs ) ;
context - > addrs ) ;
break ;
break ;
@ -1915,19 +1861,19 @@ find_expr_references_walker(Node *node,
Param * param = ( Param * ) node ;
Param * param = ( Param * ) node ;
/* A parameter must depend on the parameter's datatype */
/* A parameter must depend on the parameter's datatype */
add_object_address ( OCLASS_TYPE , param - > paramtype , 0 ,
add_object_address ( TypeRelationId , param - > paramtype , 0 ,
context - > addrs ) ;
context - > addrs ) ;
/* and its collation, just as for Consts */
/* and its collation, just as for Consts */
if ( OidIsValid ( param - > paramcollid ) & &
if ( OidIsValid ( param - > paramcollid ) & &
param - > paramcollid ! = DEFAULT_COLLATION_OID )
param - > paramcollid ! = DEFAULT_COLLATION_OID )
add_object_address ( OCLASS_COLLATION , param - > paramcollid , 0 ,
add_object_address ( CollationRelationId , param - > paramcollid , 0 ,
context - > addrs ) ;
context - > addrs ) ;
}
}
else if ( IsA ( node , FuncExpr ) )
else if ( IsA ( node , FuncExpr ) )
{
{
FuncExpr * funcexpr = ( FuncExpr * ) node ;
FuncExpr * funcexpr = ( FuncExpr * ) node ;
add_object_address ( OCLASS_PROC , funcexpr - > funcid , 0 ,
add_object_address ( ProcedureRelationId , funcexpr - > funcid , 0 ,
context - > addrs ) ;
context - > addrs ) ;
/* fall through to examine arguments */
/* fall through to examine arguments */
}
}
@ -1935,7 +1881,7 @@ find_expr_references_walker(Node *node,
{
{
OpExpr * opexpr = ( OpExpr * ) node ;
OpExpr * opexpr = ( OpExpr * ) node ;
add_object_address ( OCLASS_OPERATOR , opexpr - > opno , 0 ,
add_object_address ( OperatorRelationId , opexpr - > opno , 0 ,
context - > addrs ) ;
context - > addrs ) ;
/* fall through to examine arguments */
/* fall through to examine arguments */
}
}
@ -1943,7 +1889,7 @@ find_expr_references_walker(Node *node,
{
{
DistinctExpr * distinctexpr = ( DistinctExpr * ) node ;
DistinctExpr * distinctexpr = ( DistinctExpr * ) node ;
add_object_address ( OCLASS_OPERATOR , distinctexpr - > opno , 0 ,
add_object_address ( OperatorRelationId , distinctexpr - > opno , 0 ,
context - > addrs ) ;
context - > addrs ) ;
/* fall through to examine arguments */
/* fall through to examine arguments */
}
}
@ -1951,7 +1897,7 @@ find_expr_references_walker(Node *node,
{
{
NullIfExpr * nullifexpr = ( NullIfExpr * ) node ;
NullIfExpr * nullifexpr = ( NullIfExpr * ) node ;
add_object_address ( OCLASS_OPERATOR , nullifexpr - > opno , 0 ,
add_object_address ( OperatorRelationId , nullifexpr - > opno , 0 ,
context - > addrs ) ;
context - > addrs ) ;
/* fall through to examine arguments */
/* fall through to examine arguments */
}
}
@ -1959,7 +1905,7 @@ find_expr_references_walker(Node *node,
{
{
ScalarArrayOpExpr * opexpr = ( ScalarArrayOpExpr * ) node ;
ScalarArrayOpExpr * opexpr = ( ScalarArrayOpExpr * ) node ;
add_object_address ( OCLASS_OPERATOR , opexpr - > opno , 0 ,
add_object_address ( OperatorRelationId , opexpr - > opno , 0 ,
context - > addrs ) ;
context - > addrs ) ;
/* fall through to examine arguments */
/* fall through to examine arguments */
}
}
@ -1967,7 +1913,7 @@ find_expr_references_walker(Node *node,
{
{
Aggref * aggref = ( Aggref * ) node ;
Aggref * aggref = ( Aggref * ) node ;
add_object_address ( OCLASS_PROC , aggref - > aggfnoid , 0 ,
add_object_address ( ProcedureRelationId , aggref - > aggfnoid , 0 ,
context - > addrs ) ;
context - > addrs ) ;
/* fall through to examine arguments */
/* fall through to examine arguments */
}
}
@ -1975,7 +1921,7 @@ find_expr_references_walker(Node *node,
{
{
WindowFunc * wfunc = ( WindowFunc * ) node ;
WindowFunc * wfunc = ( WindowFunc * ) node ;
add_object_address ( OCLASS_PROC , wfunc - > winfnoid , 0 ,
add_object_address ( ProcedureRelationId , wfunc - > winfnoid , 0 ,
context - > addrs ) ;
context - > addrs ) ;
/* fall through to examine arguments */
/* fall through to examine arguments */
}
}
@ -1991,7 +1937,7 @@ find_expr_references_walker(Node *node,
*/
*/
if ( sbsref - > refrestype ! = sbsref - > refcontainertype & &
if ( sbsref - > refrestype ! = sbsref - > refcontainertype & &
sbsref - > refrestype ! = sbsref - > refelemtype )
sbsref - > refrestype ! = sbsref - > refelemtype )
add_object_address ( OCLASS_TYPE , sbsref - > refrestype , 0 ,
add_object_address ( TypeRelationId , sbsref - > refrestype , 0 ,
context - > addrs ) ;
context - > addrs ) ;
/* fall through to examine arguments */
/* fall through to examine arguments */
}
}
@ -2016,15 +1962,15 @@ find_expr_references_walker(Node *node,
* anywhere else in the expression .
* anywhere else in the expression .
*/
*/
if ( OidIsValid ( reltype ) )
if ( OidIsValid ( reltype ) )
add_object_address ( OCLASS_CLASS , reltype , fselect - > fieldnum ,
add_object_address ( RelationRelationId , reltype , fselect - > fieldnum ,
context - > addrs ) ;
context - > addrs ) ;
else
else
add_object_address ( OCLASS_TYPE , fselect - > resulttype , 0 ,
add_object_address ( TypeRelationId , fselect - > resulttype , 0 ,
context - > addrs ) ;
context - > addrs ) ;
/* the collation might not be referenced anywhere else, either */
/* the collation might not be referenced anywhere else, either */
if ( OidIsValid ( fselect - > resultcollid ) & &
if ( OidIsValid ( fselect - > resultcollid ) & &
fselect - > resultcollid ! = DEFAULT_COLLATION_OID )
fselect - > resultcollid ! = DEFAULT_COLLATION_OID )
add_object_address ( OCLASS_COLLATION , fselect - > resultcollid , 0 ,
add_object_address ( CollationRelationId , fselect - > resultcollid , 0 ,
context - > addrs ) ;
context - > addrs ) ;
}
}
else if ( IsA ( node , FieldStore ) )
else if ( IsA ( node , FieldStore ) )
@ -2038,11 +1984,11 @@ find_expr_references_walker(Node *node,
ListCell * l ;
ListCell * l ;
foreach ( l , fstore - > fieldnums )
foreach ( l , fstore - > fieldnums )
add_object_address ( OCLASS_CLASS , reltype , lfirst_int ( l ) ,
add_object_address ( RelationRelationId , reltype , lfirst_int ( l ) ,
context - > addrs ) ;
context - > addrs ) ;
}
}
else
else
add_object_address ( OCLASS_TYPE , fstore - > resulttype , 0 ,
add_object_address ( TypeRelationId , fstore - > resulttype , 0 ,
context - > addrs ) ;
context - > addrs ) ;
}
}
else if ( IsA ( node , RelabelType ) )
else if ( IsA ( node , RelabelType ) )
@ -2050,12 +1996,12 @@ find_expr_references_walker(Node *node,
RelabelType * relab = ( RelabelType * ) node ;
RelabelType * relab = ( RelabelType * ) node ;
/* since there is no function dependency, need to depend on type */
/* since there is no function dependency, need to depend on type */
add_object_address ( OCLASS_TYPE , relab - > resulttype , 0 ,
add_object_address ( TypeRelationId , relab - > resulttype , 0 ,
context - > addrs ) ;
context - > addrs ) ;
/* the collation might not be referenced anywhere else, either */
/* the collation might not be referenced anywhere else, either */
if ( OidIsValid ( relab - > resultcollid ) & &
if ( OidIsValid ( relab - > resultcollid ) & &
relab - > resultcollid ! = DEFAULT_COLLATION_OID )
relab - > resultcollid ! = DEFAULT_COLLATION_OID )
add_object_address ( OCLASS_COLLATION , relab - > resultcollid , 0 ,
add_object_address ( CollationRelationId , relab - > resultcollid , 0 ,
context - > addrs ) ;
context - > addrs ) ;
}
}
else if ( IsA ( node , CoerceViaIO ) )
else if ( IsA ( node , CoerceViaIO ) )
@ -2063,12 +2009,12 @@ find_expr_references_walker(Node *node,
CoerceViaIO * iocoerce = ( CoerceViaIO * ) node ;
CoerceViaIO * iocoerce = ( CoerceViaIO * ) node ;
/* since there is no exposed function, need to depend on type */
/* since there is no exposed function, need to depend on type */
add_object_address ( OCLASS_TYPE , iocoerce - > resulttype , 0 ,
add_object_address ( TypeRelationId , iocoerce - > resulttype , 0 ,
context - > addrs ) ;
context - > addrs ) ;
/* the collation might not be referenced anywhere else, either */
/* the collation might not be referenced anywhere else, either */
if ( OidIsValid ( iocoerce - > resultcollid ) & &
if ( OidIsValid ( iocoerce - > resultcollid ) & &
iocoerce - > resultcollid ! = DEFAULT_COLLATION_OID )
iocoerce - > resultcollid ! = DEFAULT_COLLATION_OID )
add_object_address ( OCLASS_COLLATION , iocoerce - > resultcollid , 0 ,
add_object_address ( CollationRelationId , iocoerce - > resultcollid , 0 ,
context - > addrs ) ;
context - > addrs ) ;
}
}
else if ( IsA ( node , ArrayCoerceExpr ) )
else if ( IsA ( node , ArrayCoerceExpr ) )
@ -2076,12 +2022,12 @@ find_expr_references_walker(Node *node,
ArrayCoerceExpr * acoerce = ( ArrayCoerceExpr * ) node ;
ArrayCoerceExpr * acoerce = ( ArrayCoerceExpr * ) node ;
/* as above, depend on type */
/* as above, depend on type */
add_object_address ( OCLASS_TYPE , acoerce - > resulttype , 0 ,
add_object_address ( TypeRelationId , acoerce - > resulttype , 0 ,
context - > addrs ) ;
context - > addrs ) ;
/* the collation might not be referenced anywhere else, either */
/* the collation might not be referenced anywhere else, either */
if ( OidIsValid ( acoerce - > resultcollid ) & &
if ( OidIsValid ( acoerce - > resultcollid ) & &
acoerce - > resultcollid ! = DEFAULT_COLLATION_OID )
acoerce - > resultcollid ! = DEFAULT_COLLATION_OID )
add_object_address ( OCLASS_COLLATION , acoerce - > resultcollid , 0 ,
add_object_address ( CollationRelationId , acoerce - > resultcollid , 0 ,
context - > addrs ) ;
context - > addrs ) ;
/* fall through to examine arguments */
/* fall through to examine arguments */
}
}
@ -2090,21 +2036,21 @@ find_expr_references_walker(Node *node,
ConvertRowtypeExpr * cvt = ( ConvertRowtypeExpr * ) node ;
ConvertRowtypeExpr * cvt = ( ConvertRowtypeExpr * ) node ;
/* since there is no function dependency, need to depend on type */
/* since there is no function dependency, need to depend on type */
add_object_address ( OCLASS_TYPE , cvt - > resulttype , 0 ,
add_object_address ( TypeRelationId , cvt - > resulttype , 0 ,
context - > addrs ) ;
context - > addrs ) ;
}
}
else if ( IsA ( node , CollateExpr ) )
else if ( IsA ( node , CollateExpr ) )
{
{
CollateExpr * coll = ( CollateExpr * ) node ;
CollateExpr * coll = ( CollateExpr * ) node ;
add_object_address ( OCLASS_COLLATION , coll - > collOid , 0 ,
add_object_address ( CollationRelationId , coll - > collOid , 0 ,
context - > addrs ) ;
context - > addrs ) ;
}
}
else if ( IsA ( node , RowExpr ) )
else if ( IsA ( node , RowExpr ) )
{
{
RowExpr * rowexpr = ( RowExpr * ) node ;
RowExpr * rowexpr = ( RowExpr * ) node ;
add_object_address ( OCLASS_TYPE , rowexpr - > row_typeid , 0 ,
add_object_address ( TypeRelationId , rowexpr - > row_typeid , 0 ,
context - > addrs ) ;
context - > addrs ) ;
}
}
else if ( IsA ( node , RowCompareExpr ) )
else if ( IsA ( node , RowCompareExpr ) )
@ -2114,12 +2060,12 @@ find_expr_references_walker(Node *node,
foreach ( l , rcexpr - > opnos )
foreach ( l , rcexpr - > opnos )
{
{
add_object_address ( OCLASS_OPERATOR , lfirst_oid ( l ) , 0 ,
add_object_address ( OperatorRelationId , lfirst_oid ( l ) , 0 ,
context - > addrs ) ;
context - > addrs ) ;
}
}
foreach ( l , rcexpr - > opfamilies )
foreach ( l , rcexpr - > opfamilies )
{
{
add_object_address ( OCLASS_OPFAMILY , lfirst_oid ( l ) , 0 ,
add_object_address ( OperatorFamilyRelationId , lfirst_oid ( l ) , 0 ,
context - > addrs ) ;
context - > addrs ) ;
}
}
/* fall through to examine arguments */
/* fall through to examine arguments */
@ -2128,14 +2074,14 @@ find_expr_references_walker(Node *node,
{
{
CoerceToDomain * cd = ( CoerceToDomain * ) node ;
CoerceToDomain * cd = ( CoerceToDomain * ) node ;
add_object_address ( OCLASS_TYPE , cd - > resulttype , 0 ,
add_object_address ( TypeRelationId , cd - > resulttype , 0 ,
context - > addrs ) ;
context - > addrs ) ;
}
}
else if ( IsA ( node , NextValueExpr ) )
else if ( IsA ( node , NextValueExpr ) )
{
{
NextValueExpr * nve = ( NextValueExpr * ) node ;
NextValueExpr * nve = ( NextValueExpr * ) node ;
add_object_address ( OCLASS_CLASS , nve - > seqid , 0 ,
add_object_address ( RelationRelationId , nve - > seqid , 0 ,
context - > addrs ) ;
context - > addrs ) ;
}
}
else if ( IsA ( node , OnConflictExpr ) )
else if ( IsA ( node , OnConflictExpr ) )
@ -2143,7 +2089,7 @@ find_expr_references_walker(Node *node,
OnConflictExpr * onconflict = ( OnConflictExpr * ) node ;
OnConflictExpr * onconflict = ( OnConflictExpr * ) node ;
if ( OidIsValid ( onconflict - > constraint ) )
if ( OidIsValid ( onconflict - > constraint ) )
add_object_address ( OCLASS_CONSTRAINT , onconflict - > constraint , 0 ,
add_object_address ( ConstraintRelationId , onconflict - > constraint , 0 ,
context - > addrs ) ;
context - > addrs ) ;
/* fall through to examine arguments */
/* fall through to examine arguments */
}
}
@ -2151,10 +2097,10 @@ find_expr_references_walker(Node *node,
{
{
SortGroupClause * sgc = ( SortGroupClause * ) node ;
SortGroupClause * sgc = ( SortGroupClause * ) node ;
add_object_address ( OCLASS_OPERATOR , sgc - > eqop , 0 ,
add_object_address ( OperatorRelationId , sgc - > eqop , 0 ,
context - > addrs ) ;
context - > addrs ) ;
if ( OidIsValid ( sgc - > sortop ) )
if ( OidIsValid ( sgc - > sortop ) )
add_object_address ( OCLASS_OPERATOR , sgc - > sortop , 0 ,
add_object_address ( OperatorRelationId , sgc - > sortop , 0 ,
context - > addrs ) ;
context - > addrs ) ;
return false ;
return false ;
}
}
@ -2163,14 +2109,14 @@ find_expr_references_walker(Node *node,
WindowClause * wc = ( WindowClause * ) node ;
WindowClause * wc = ( WindowClause * ) node ;
if ( OidIsValid ( wc - > startInRangeFunc ) )
if ( OidIsValid ( wc - > startInRangeFunc ) )
add_object_address ( OCLASS_PROC , wc - > startInRangeFunc , 0 ,
add_object_address ( ProcedureRelationId , wc - > startInRangeFunc , 0 ,
context - > addrs ) ;
context - > addrs ) ;
if ( OidIsValid ( wc - > endInRangeFunc ) )
if ( OidIsValid ( wc - > endInRangeFunc ) )
add_object_address ( OCLASS_PROC , wc - > endInRangeFunc , 0 ,
add_object_address ( ProcedureRelationId , wc - > endInRangeFunc , 0 ,
context - > addrs ) ;
context - > addrs ) ;
if ( OidIsValid ( wc - > inRangeColl ) & &
if ( OidIsValid ( wc - > inRangeColl ) & &
wc - > inRangeColl ! = DEFAULT_COLLATION_OID )
wc - > inRangeColl ! = DEFAULT_COLLATION_OID )
add_object_address ( OCLASS_COLLATION , wc - > inRangeColl , 0 ,
add_object_address ( CollationRelationId , wc - > inRangeColl , 0 ,
context - > addrs ) ;
context - > addrs ) ;
/* fall through to examine substructure */
/* fall through to examine substructure */
}
}
@ -2179,13 +2125,13 @@ find_expr_references_walker(Node *node,
CTECycleClause * cc = ( CTECycleClause * ) node ;
CTECycleClause * cc = ( CTECycleClause * ) node ;
if ( OidIsValid ( cc - > cycle_mark_type ) )
if ( OidIsValid ( cc - > cycle_mark_type ) )
add_object_address ( OCLASS_TYPE , cc - > cycle_mark_type , 0 ,
add_object_address ( TypeRelationId , cc - > cycle_mark_type , 0 ,
context - > addrs ) ;
context - > addrs ) ;
if ( OidIsValid ( cc - > cycle_mark_collation ) )
if ( OidIsValid ( cc - > cycle_mark_collation ) )
add_object_address ( OCLASS_COLLATION , cc - > cycle_mark_collation , 0 ,
add_object_address ( CollationRelationId , cc - > cycle_mark_collation , 0 ,
context - > addrs ) ;
context - > addrs ) ;
if ( OidIsValid ( cc - > cycle_mark_neop ) )
if ( OidIsValid ( cc - > cycle_mark_neop ) )
add_object_address ( OCLASS_OPERATOR , cc - > cycle_mark_neop , 0 ,
add_object_address ( OperatorRelationId , cc - > cycle_mark_neop , 0 ,
context - > addrs ) ;
context - > addrs ) ;
/* fall through to examine substructure */
/* fall through to examine substructure */
}
}
@ -2219,7 +2165,7 @@ find_expr_references_walker(Node *node,
switch ( rte - > rtekind )
switch ( rte - > rtekind )
{
{
case RTE_RELATION :
case RTE_RELATION :
add_object_address ( OCLASS_CLASS , rte - > relid , 0 ,
add_object_address ( RelationRelationId , rte - > relid , 0 ,
context - > addrs ) ;
context - > addrs ) ;
break ;
break ;
case RTE_JOIN :
case RTE_JOIN :
@ -2277,7 +2223,7 @@ find_expr_references_walker(Node *node,
if ( tle - > resjunk )
if ( tle - > resjunk )
continue ; /* ignore junk tlist items */
continue ; /* ignore junk tlist items */
add_object_address ( OCLASS_CLASS , rte - > relid , tle - > resno ,
add_object_address ( RelationRelationId , rte - > relid , tle - > resno ,
context - > addrs ) ;
context - > addrs ) ;
}
}
}
}
@ -2288,7 +2234,7 @@ find_expr_references_walker(Node *node,
*/
*/
foreach ( lc , query - > constraintDeps )
foreach ( lc , query - > constraintDeps )
{
{
add_object_address ( OCLASS_CONSTRAINT , lfirst_oid ( lc ) , 0 ,
add_object_address ( ConstraintRelationId , lfirst_oid ( lc ) , 0 ,
context - > addrs ) ;
context - > addrs ) ;
}
}
@ -2322,7 +2268,7 @@ find_expr_references_walker(Node *node,
*/
*/
foreach ( ct , rtfunc - > funccoltypes )
foreach ( ct , rtfunc - > funccoltypes )
{
{
add_object_address ( OCLASS_TYPE , lfirst_oid ( ct ) , 0 ,
add_object_address ( TypeRelationId , lfirst_oid ( ct ) , 0 ,
context - > addrs ) ;
context - > addrs ) ;
}
}
foreach ( ct , rtfunc - > funccolcollations )
foreach ( ct , rtfunc - > funccolcollations )
@ -2330,7 +2276,7 @@ find_expr_references_walker(Node *node,
Oid collid = lfirst_oid ( ct ) ;
Oid collid = lfirst_oid ( ct ) ;
if ( OidIsValid ( collid ) & & collid ! = DEFAULT_COLLATION_OID )
if ( OidIsValid ( collid ) & & collid ! = DEFAULT_COLLATION_OID )
add_object_address ( OCLASS_COLLATION , collid , 0 ,
add_object_address ( CollationRelationId , collid , 0 ,
context - > addrs ) ;
context - > addrs ) ;
}
}
}
}
@ -2344,7 +2290,7 @@ find_expr_references_walker(Node *node,
*/
*/
foreach ( ct , tf - > coltypes )
foreach ( ct , tf - > coltypes )
{
{
add_object_address ( OCLASS_TYPE , lfirst_oid ( ct ) , 0 ,
add_object_address ( TypeRelationId , lfirst_oid ( ct ) , 0 ,
context - > addrs ) ;
context - > addrs ) ;
}
}
foreach ( ct , tf - > colcollations )
foreach ( ct , tf - > colcollations )
@ -2352,7 +2298,7 @@ find_expr_references_walker(Node *node,
Oid collid = lfirst_oid ( ct ) ;
Oid collid = lfirst_oid ( ct ) ;
if ( OidIsValid ( collid ) & & collid ! = DEFAULT_COLLATION_OID )
if ( OidIsValid ( collid ) & & collid ! = DEFAULT_COLLATION_OID )
add_object_address ( OCLASS_COLLATION , collid , 0 ,
add_object_address ( CollationRelationId , collid , 0 ,
context - > addrs ) ;
context - > addrs ) ;
}
}
}
}
@ -2360,7 +2306,7 @@ find_expr_references_walker(Node *node,
{
{
TableSampleClause * tsc = ( TableSampleClause * ) node ;
TableSampleClause * tsc = ( TableSampleClause * ) node ;
add_object_address ( OCLASS_PROC , tsc - > tsmhandler , 0 ,
add_object_address ( ProcedureRelationId , tsc - > tsmhandler , 0 ,
context - > addrs ) ;
context - > addrs ) ;
/* fall through to examine arguments */
/* fall through to examine arguments */
}
}
@ -2406,7 +2352,7 @@ process_function_rte_ref(RangeTblEntry *rte, AttrNumber attnum,
Assert ( attnum - atts_done < = tupdesc - > natts ) ;
Assert ( attnum - atts_done < = tupdesc - > natts ) ;
if ( OidIsValid ( reltype ) ) /* can this fail? */
if ( OidIsValid ( reltype ) ) /* can this fail? */
add_object_address ( OCLASS_CLASS , reltype ,
add_object_address ( RelationRelationId , reltype ,
attnum - atts_done ,
attnum - atts_done ,
context - > addrs ) ;
context - > addrs ) ;
return ;
return ;
@ -2553,12 +2499,9 @@ new_object_addresses(void)
/*
/*
* Add an entry to an ObjectAddresses array .
* Add an entry to an ObjectAddresses array .
*
* It is convenient to specify the class by ObjectClass rather than directly
* by catalog OID .
*/
*/
static void
static void
add_object_address ( ObjectClass oclass , Oid objectId , int32 subId ,
add_object_address ( Oid classId , Oid objectId , int32 subId ,
ObjectAddresses * addrs )
ObjectAddresses * addrs )
{
{
ObjectAddress * item ;
ObjectAddress * item ;
@ -2573,7 +2516,7 @@ add_object_address(ObjectClass oclass, Oid objectId, int32 subId,
}
}
/* record this item */
/* record this item */
item = addrs - > refs + addrs - > numrefs ;
item = addrs - > refs + addrs - > numrefs ;
item - > classId = object_classes [ oclass ] ;
item - > classId = classId ;
item - > objectId = objectId ;
item - > objectId = objectId ;
item - > objectSubId = subId ;
item - > objectSubId = subId ;
addrs - > numrefs + + ;
addrs - > numrefs + + ;
@ -2836,8 +2779,8 @@ free_object_addresses(ObjectAddresses *addrs)
/*
/*
* Determine the class of a given object identified by objectAddress .
* Determine the class of a given object identified by objectAddress .
*
*
* This function is essentially the reverse mapping for the object_classes [ ]
* We implement it as a function instead of an array because the OIDs aren ' t
* table . We implement it as a function because the OIDs aren ' t consecutive .
* consecutive .
*/
*/
ObjectClass
ObjectClass
getObjectClass ( const ObjectAddress * object )
getObjectClass ( const ObjectAddress * object )