summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/include')
-rw-r--r--src/include/nodes/parsenodes.h2
-rw-r--r--src/include/nodes/primnodes.h34
-rw-r--r--src/include/parser/kwlist.h1
3 files changed, 35 insertions, 2 deletions
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h
index 01fa1a6c2e9..5e470d59023 100644
--- a/src/include/nodes/parsenodes.h
+++ b/src/include/nodes/parsenodes.h
@@ -1844,6 +1844,7 @@ typedef enum JsonTableColumnType
JTC_REGULAR,
JTC_EXISTS,
JTC_FORMATTED,
+ JTC_NESTED,
} JsonTableColumnType;
/*
@@ -1860,6 +1861,7 @@ typedef struct JsonTableColumn
JsonFormat *format; /* JSON format clause, if specified */
JsonWrapper wrapper; /* WRAPPER behavior for formatted columns */
JsonQuotes quotes; /* omit or keep quotes on scalar strings? */
+ List *columns; /* nested columns */
JsonBehavior *on_empty; /* ON EMPTY behavior */
JsonBehavior *on_error; /* ON ERROR behavior */
int location; /* token location, or -1 if unknown */
diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h
index 6657f34103f..dafe93a4c95 100644
--- a/src/include/nodes/primnodes.h
+++ b/src/include/nodes/primnodes.h
@@ -1855,7 +1855,10 @@ typedef struct JsonTablePlan
NodeTag type;
} JsonTablePlan;
-/* JSON_TABLE plan to evaluate a JSON path expression */
+/*
+ * JSON_TABLE plan to evaluate a JSON path expression and NESTED paths, if
+ * any.
+ */
typedef struct JsonTablePathScan
{
JsonTablePlan plan;
@@ -1863,10 +1866,37 @@ typedef struct JsonTablePathScan
/* JSON path to evaluate */
JsonTablePath *path;
- /* ERROR/EMPTY ON ERROR behavior */
+ /*
+ * ERROR/EMPTY ON ERROR behavior; only significant in the plan for the
+ * top-level path.
+ */
bool errorOnError;
+
+ /* Plan(s) for nested columns, if any. */
+ JsonTablePlan *child;
+
+ /*
+ * 0-based index in TableFunc.colvalexprs of the 1st and the last column
+ * covered by this plan. Both are -1 if all columns are nested and thus
+ * computed by the child plan(s).
+ */
+ int colMin;
+ int colMax;
} JsonTablePathScan;
+/*
+ * JsonTableSiblingJoin -
+ * Plan to join rows of sibling NESTED COLUMNS clauses in the same parent
+ * COLUMNS clause
+ */
+typedef struct JsonTableSiblingJoin
+{
+ JsonTablePlan plan;
+
+ JsonTablePlan *lplan;
+ JsonTablePlan *rplan;
+} JsonTableSiblingJoin;
+
/* ----------------
* NullTest
*
diff --git a/src/include/parser/kwlist.h b/src/include/parser/kwlist.h
index 9e4be53d93d..f9a4afd4723 100644
--- a/src/include/parser/kwlist.h
+++ b/src/include/parser/kwlist.h
@@ -286,6 +286,7 @@ PG_KEYWORD("names", NAMES, UNRESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("national", NATIONAL, COL_NAME_KEYWORD, BARE_LABEL)
PG_KEYWORD("natural", NATURAL, TYPE_FUNC_NAME_KEYWORD, BARE_LABEL)
PG_KEYWORD("nchar", NCHAR, COL_NAME_KEYWORD, BARE_LABEL)
+PG_KEYWORD("nested", NESTED, UNRESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("new", NEW, UNRESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("next", NEXT, UNRESERVED_KEYWORD, BARE_LABEL)
PG_KEYWORD("nfc", NFC, UNRESERVED_KEYWORD, BARE_LABEL)