diff options
Diffstat (limited to 'src/backend/nodes/makefuncs.c')
-rw-r--r-- | src/backend/nodes/makefuncs.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/src/backend/nodes/makefuncs.c b/src/backend/nodes/makefuncs.c index b13cfa4201d..61ac172a857 100644 --- a/src/backend/nodes/makefuncs.c +++ b/src/backend/nodes/makefuncs.c @@ -538,6 +538,22 @@ makeFuncExpr(Oid funcid, Oid rettype, List *args, } /* + * makeStringConst - + * build a A_Const node of type T_String for given string + */ +Node * +makeStringConst(char *str, int location) +{ + A_Const *n = makeNode(A_Const); + + n->val.sval.type = T_String; + n->val.sval.sval = str; + n->location = location; + + return (Node *) n; +} + +/* * makeDefElem - * build a DefElem node * @@ -905,3 +921,40 @@ makeJsonIsPredicate(Node *expr, JsonFormat *format, JsonValueType item_type, return (Node *) n; } + +/* + * makeJsonTablePathSpec - + * Make JsonTablePathSpec node from given path string and name (if any) + */ +JsonTablePathSpec * +makeJsonTablePathSpec(char *string, char *name, int string_location, + int name_location) +{ + JsonTablePathSpec *pathspec = makeNode(JsonTablePathSpec); + + Assert(string != NULL); + pathspec->string = makeStringConst(string, string_location); + if (name != NULL) + pathspec->name = pstrdup(name); + + pathspec->name_location = name_location; + pathspec->location = string_location; + + return pathspec; +} + +/* + * makeJsonTablePath - + * Make JsonTablePath node for given path string and name + */ +JsonTablePath * +makeJsonTablePath(Const *pathvalue, char *pathname) +{ + JsonTablePath *path = makeNode(JsonTablePath); + + Assert(IsA(pathvalue, Const)); + path->value = pathvalue; + path->name = pathname; + + return path; +} |