mirror of
https://github.com/postgres/postgres.git
synced 2025-12-02 23:42:46 +03:00
Add a reverse-translation column number array to struct AppendRelInfo.
This provides for cheaper mapping of child columns back to parent columns. The one existing use-case in examine_simple_variable() would hardly justify this by itself; but an upcoming bug fix will make use of this array in a mainstream code path, and it seems likely that we'll find other uses for it as we continue to build out the partitioning infrastructure. Discussion: https://postgr.es/m/12424.1575168015@sss.pgh.pa.us
This commit is contained in:
@@ -2327,6 +2327,8 @@ _copyAppendRelInfo(const AppendRelInfo *from)
|
||||
COPY_SCALAR_FIELD(parent_reltype);
|
||||
COPY_SCALAR_FIELD(child_reltype);
|
||||
COPY_NODE_FIELD(translated_vars);
|
||||
COPY_SCALAR_FIELD(num_child_cols);
|
||||
COPY_POINTER_FIELD(parent_colnos, from->num_child_cols * sizeof(AttrNumber));
|
||||
COPY_SCALAR_FIELD(parent_reloid);
|
||||
|
||||
return newnode;
|
||||
|
||||
@@ -900,6 +900,8 @@ _equalAppendRelInfo(const AppendRelInfo *a, const AppendRelInfo *b)
|
||||
COMPARE_SCALAR_FIELD(parent_reltype);
|
||||
COMPARE_SCALAR_FIELD(child_reltype);
|
||||
COMPARE_NODE_FIELD(translated_vars);
|
||||
COMPARE_SCALAR_FIELD(num_child_cols);
|
||||
COMPARE_POINTER_FIELD(parent_colnos, a->num_child_cols * sizeof(AttrNumber));
|
||||
COMPARE_SCALAR_FIELD(parent_reloid);
|
||||
|
||||
return true;
|
||||
|
||||
@@ -3103,6 +3103,7 @@ expression_tree_mutator(Node *node,
|
||||
|
||||
FLATCOPY(newnode, appinfo, AppendRelInfo);
|
||||
MUTATE(newnode->translated_vars, appinfo->translated_vars, List *);
|
||||
/* Assume nothing need be done with parent_colnos[] */
|
||||
return (Node *) newnode;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -2509,6 +2509,8 @@ _outAppendRelInfo(StringInfo str, const AppendRelInfo *node)
|
||||
WRITE_OID_FIELD(parent_reltype);
|
||||
WRITE_OID_FIELD(child_reltype);
|
||||
WRITE_NODE_FIELD(translated_vars);
|
||||
WRITE_INT_FIELD(num_child_cols);
|
||||
WRITE_ATTRNUMBER_ARRAY(parent_colnos, node->num_child_cols);
|
||||
WRITE_OID_FIELD(parent_reloid);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user