diff options
-rw-r--r-- | doc/src/sgml/func.sgml | 9 | ||||
-rw-r--r-- | src/backend/utils/adt/jsonpath_exec.c | 2 | ||||
-rw-r--r-- | src/include/utils/jsonpath.h | 8 |
3 files changed, 9 insertions, 10 deletions
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 8dfb42ad4db..92a0f49e6a1 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -18942,7 +18942,7 @@ where <replaceable class="parameter">json_table_column</replaceable> is: <optional> { ERROR | NULL | EMPTY { ARRAY | OBJECT } | DEFAULT <replaceable>expression</replaceable> } ON ERROR </optional> | <replaceable>name</replaceable> <replaceable>type</replaceable> EXISTS <optional> PATH <replaceable>path_expression</replaceable> </optional> <optional> { ERROR | TRUE | FALSE | UNKNOWN } ON ERROR </optional> - | NESTED <optional> PATH </optional> <replaceable>json_path_specification</replaceable> <optional> AS <replaceable>json_path_name</replaceable> </optional> COLUMNS ( <replaceable>json_table_column</replaceable> <optional>, ...</optional> ) + | NESTED <optional> PATH </optional> <replaceable>path_expression</replaceable> <optional> AS <replaceable>json_path_name</replaceable> </optional> COLUMNS ( <replaceable>json_table_column</replaceable> <optional>, ...</optional> ) </synopsis> <para> @@ -19083,7 +19083,7 @@ where <replaceable class="parameter">json_table_column</replaceable> is: <varlistentry> <term> - <literal>NESTED <optional> PATH </optional></literal> <replaceable>json_path_specification</replaceable> <optional> <literal>AS</literal> <replaceable>json_path_name</replaceable> </optional> + <literal>NESTED <optional> PATH </optional></literal> <replaceable>path_expression</replaceable> <optional> <literal>AS</literal> <replaceable>json_path_name</replaceable> </optional> <literal>COLUMNS</literal> ( <replaceable>json_table_column</replaceable> <optional>, ...</optional> ) </term> <listitem> @@ -19315,8 +19315,9 @@ SELECT * FROM JSON_TABLE ( "books": [{"name": "Mystery", "authors": [{"name": "Brown Dan"}]}, {"name": "Wonder", "authors": [{"name": "Jun Murakami"}, {"name":"Craig Doe"}]}] -}}'::json, '$.favs[*]' -COLUMNS (user_id FOR ORDINALITY, +}}'::json, '$.favorites[*]' +COLUMNS ( + user_id FOR ORDINALITY, NESTED '$.movies[*]' COLUMNS ( movie_id FOR ORDINALITY, diff --git a/src/backend/utils/adt/jsonpath_exec.c b/src/backend/utils/adt/jsonpath_exec.c index e74dc1b2d42..4daf1a68d9d 100644 --- a/src/backend/utils/adt/jsonpath_exec.c +++ b/src/backend/utils/adt/jsonpath_exec.c @@ -3935,7 +3935,7 @@ JsonPathQuery(Datum jb, JsonPath *jp, JsonWrapper wrapper, bool *empty, JsonContainerIsScalar(singleton->val.binary.data)); else { - elog(ERROR, "unrecognized json wrapper %d", wrapper); + elog(ERROR, "unrecognized json wrapper %d", (int) wrapper); wrap = false; } diff --git a/src/include/utils/jsonpath.h b/src/include/utils/jsonpath.h index 0bcc1ac569d..69c180c2e29 100644 --- a/src/include/utils/jsonpath.h +++ b/src/include/utils/jsonpath.h @@ -281,12 +281,9 @@ extern JsonPathParseResult *parsejsonpath(const char *str, int len, extern bool jspConvertRegexFlags(uint32 xflags, int *result, struct Node *escontext); - /* - * Evaluation of jsonpath + * Struct for details about external variables passed into jsonpath executor */ - -/* External variable passed into jsonpath. */ typedef struct JsonPathVariable { char *name; @@ -297,7 +294,7 @@ typedef struct JsonPathVariable } JsonPathVariable; -/* SQL/JSON item */ +/* SQL/JSON query functions */ extern bool JsonPathExists(Datum jb, JsonPath *path, bool *error, List *vars); extern Datum JsonPathQuery(Datum jb, JsonPath *jp, JsonWrapper wrapper, bool *empty, bool *error, List *vars, @@ -306,6 +303,7 @@ extern JsonbValue *JsonPathValue(Datum jb, JsonPath *jp, bool *empty, bool *error, List *vars, const char *column_name); +/* For JSON_TABLE() */ extern PGDLLIMPORT const TableFuncRoutine JsonbTableRoutine; #endif |