aboutsummaryrefslogtreecommitdiff
path: root/src/backend/nodes/makefuncs.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/nodes/makefuncs.c')
-rw-r--r--src/backend/nodes/makefuncs.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/backend/nodes/makefuncs.c b/src/backend/nodes/makefuncs.c
index f625c32df7a..d72a85ee1b1 100644
--- a/src/backend/nodes/makefuncs.c
+++ b/src/backend/nodes/makefuncs.c
@@ -477,6 +477,36 @@ makeTypeNameFromOid(Oid typeOid, int32 typmod)
}
/*
+ * makeColumnDef -
+ * build a ColumnDef node to represent a simple column definition.
+ *
+ * Type and collation are specified by OID.
+ * Other properties are all basic to start with.
+ */
+ColumnDef *
+makeColumnDef(const char *colname, Oid typeOid, int32 typmod, Oid collOid)
+{
+ ColumnDef *n = makeNode(ColumnDef);
+
+ n->colname = pstrdup(colname);
+ n->typeName = makeTypeNameFromOid(typeOid, typmod);
+ n->inhcount = 0;
+ n->is_local = true;
+ n->is_not_null = false;
+ n->is_from_type = false;
+ n->storage = 0;
+ n->raw_default = NULL;
+ n->cooked_default = NULL;
+ n->collClause = NULL;
+ n->collOid = collOid;
+ n->constraints = NIL;
+ n->fdwoptions = NIL;
+ n->location = -1;
+
+ return n;
+}
+
+/*
* makeFuncExpr -
* build an expression tree representing a function call.
*