Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitef744eb

Browse files
committed
SQL/JSON: Miscellaneous fixes and improvements
This addresses some post-commit review comments for commits6185c97,de36004, and 9425c596a0, with the following changes:* Fix JSON_TABLE() syntax documentation to use the term "path_expression" for JSON path expressions instead of "json_path_specification" to be consistent with the other SQL/JSON functions.* Fix a typo in the example code in JSON_TABLE() documentation.* Rewrite some newly added comments in jsonpath.h.* In JsonPathQuery(), add missing cast to int before printing an enum value.Reported-by: Jian He <jian.universality@gmail.com>Discussion:https://postgr.es/m/CACJufxG_e0QLCgaELrr2ZNz7AxPeGCNKAORe3fHtFCQLsH4J4Q@mail.gmail.com
1 parentc0fc075 commitef744eb

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

‎doc/src/sgml/func.sgml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18942,7 +18942,7 @@ where <replaceable class="parameter">json_table_column</replaceable> is:
1894218942
<optional> { ERROR | NULL | EMPTY { ARRAY | OBJECT } | DEFAULT <replaceable>expression</replaceable> } ON ERROR </optional>
1894318943
| <replaceable>name</replaceable> <replaceable>type</replaceable> EXISTS <optional> PATH <replaceable>path_expression</replaceable> </optional>
1894418944
<optional> { ERROR | TRUE | FALSE | UNKNOWN } ON ERROR </optional>
18945-
| 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> )
18945+
| NESTED <optional> PATH </optional> <replaceable>path_expression</replaceable> <optional> AS <replaceable>json_path_name</replaceable> </optional> COLUMNS ( <replaceable>json_table_column</replaceable> <optional>, ...</optional> )
1894618946
</synopsis>
1894718947

1894818948
<para>
@@ -19083,7 +19083,7 @@ where <replaceable class="parameter">json_table_column</replaceable> is:
1908319083

1908419084
<varlistentry>
1908519085
<term>
19086-
<literal>NESTED <optional> PATH </optional></literal> <replaceable>json_path_specification</replaceable> <optional> <literal>AS</literal> <replaceable>json_path_name</replaceable> </optional>
19086+
<literal>NESTED <optional> PATH </optional></literal> <replaceable>path_expression</replaceable> <optional> <literal>AS</literal> <replaceable>json_path_name</replaceable> </optional>
1908719087
<literal>COLUMNS</literal> ( <replaceable>json_table_column</replaceable> <optional>, ...</optional> )
1908819088
</term>
1908919089
<listitem>
@@ -19315,8 +19315,9 @@ SELECT * FROM JSON_TABLE (
1931519315
"books":
1931619316
[{"name": "Mystery", "authors": [{"name": "Brown Dan"}]},
1931719317
{"name": "Wonder", "authors": [{"name": "Jun Murakami"}, {"name":"Craig Doe"}]}]
19318-
}}'::json, '$.favs[*]'
19319-
COLUMNS (user_id FOR ORDINALITY,
19318+
}}'::json, '$.favorites[*]'
19319+
COLUMNS (
19320+
user_id FOR ORDINALITY,
1932019321
NESTED '$.movies[*]'
1932119322
COLUMNS (
1932219323
movie_id FOR ORDINALITY,

‎src/backend/utils/adt/jsonpath_exec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3935,7 +3935,7 @@ JsonPathQuery(Datum jb, JsonPath *jp, JsonWrapper wrapper, bool *empty,
39353935
JsonContainerIsScalar(singleton->val.binary.data));
39363936
else
39373937
{
3938-
elog(ERROR,"unrecognized json wrapper %d",wrapper);
3938+
elog(ERROR,"unrecognized json wrapper %d",(int)wrapper);
39393939
wrap= false;
39403940
}
39413941

‎src/include/utils/jsonpath.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -281,12 +281,9 @@ extern JsonPathParseResult *parsejsonpath(const char *str, int len,
281281
externbooljspConvertRegexFlags(uint32xflags,int*result,
282282
structNode*escontext);
283283

284-
285284
/*
286-
*Evaluation ofjsonpath
285+
*Struct for details about external variables passed intojsonpath executor
287286
*/
288-
289-
/* External variable passed into jsonpath. */
290287
typedefstructJsonPathVariable
291288
{
292289
char*name;
@@ -297,7 +294,7 @@ typedef struct JsonPathVariable
297294
}JsonPathVariable;
298295

299296

300-
/* SQL/JSONitem */
297+
/* SQL/JSONquery functions */
301298
externboolJsonPathExists(Datumjb,JsonPath*path,bool*error,List*vars);
302299
externDatumJsonPathQuery(Datumjb,JsonPath*jp,JsonWrapperwrapper,
303300
bool*empty,bool*error,List*vars,
@@ -306,6 +303,7 @@ extern JsonbValue *JsonPathValue(Datum jb, JsonPath *jp, bool *empty,
306303
bool*error,List*vars,
307304
constchar*column_name);
308305

306+
/* For JSON_TABLE() */
309307
externPGDLLIMPORTconstTableFuncRoutineJsonbTableRoutine;
310308

311309
#endif

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp