diff options
Diffstat (limited to 'src/include/nodes')
-rw-r--r-- | src/include/nodes/nodes.h | 1 | ||||
-rw-r--r-- | src/include/nodes/relation.h | 22 |
2 files changed, 23 insertions, 0 deletions
diff --git a/src/include/nodes/nodes.h b/src/include/nodes/nodes.h index 3f22bdb5a8a..84efa8e886d 100644 --- a/src/include/nodes/nodes.h +++ b/src/include/nodes/nodes.h @@ -223,6 +223,7 @@ typedef enum NodeTag T_PlannerGlobal, T_RelOptInfo, T_IndexOptInfo, + T_ForeignKeyOptInfo, T_ParamPathInfo, T_Path, T_IndexPath, diff --git a/src/include/nodes/relation.h b/src/include/nodes/relation.h index 5264d3cc76d..d430f6e9fd4 100644 --- a/src/include/nodes/relation.h +++ b/src/include/nodes/relation.h @@ -516,6 +516,7 @@ typedef struct RelOptInfo List *lateral_vars; /* LATERAL Vars and PHVs referenced by rel */ Relids lateral_referencers; /* rels that reference me laterally */ List *indexlist; /* list of IndexOptInfo */ + List *fkeylist; /* list of ForeignKeyOptInfo */ BlockNumber pages; /* size estimates derived from pg_class */ double tuples; double allvisfrac; @@ -621,6 +622,27 @@ typedef struct IndexOptInfo void (*amcostestimate) (); /* AM's cost estimator */ } IndexOptInfo; +/* + * ForeignKeyOptInfo + * Per-foreign-key information for planning/optimization + * + * Only includes columns from pg_constraint related to foreign keys. + * + * conkeys[], confkeys[] and conpfeqop[] each have nkeys entries. + */ +typedef struct ForeignKeyOptInfo +{ + NodeTag type; + + Oid conrelid; /* relation constrained by the foreign key */ + Oid confrelid; /* relation referenced by the foreign key */ + + int nkeys; /* number of columns in the foreign key */ + int *conkeys; /* attnums of columns in the constrained table */ + int *confkeys; /* attnums of columns in the referenced table */ + Oid *conpfeqop; /* OIDs of equality operators used by the FK */ + +} ForeignKeyOptInfo; /* * EquivalenceClasses |