public inbox for [email protected]
help / color / mirror / Atom feedFrom: jian he <[email protected]>
To: Amit Langote <[email protected]>
Cc: Alvaro Herrera <[email protected]>
Cc: Andres Freund <[email protected]>
Cc: Erik Rijkers <[email protected]>
Cc: Andrew Dunstan <[email protected]>
Cc: PostgreSQL-development <[email protected]>
Subject: Re: remaining sql/json patches
Date: Thu, 25 Jan 2024 17:20:00 +0800
Message-ID: <CACJufxHUV-rOFex=VTLO-5y0y2gUg6LFQw59HFHUpZZxbcHEeQ@mail.gmail.com> (raw)
In-Reply-To: <CA+HiwqFctBg7--Om7fFdYUwwfJ5xb1M3L4E3d=-HZ=nXK_ETtA@mail.gmail.com>
References: <[email protected]>
<[email protected]>
<CA+HiwqGN6DUKAVabqEhQ8e=0593emvJ6P4rQ_8x8N84k=mWq1Q@mail.gmail.com>
<CA+HiwqFctBg7--Om7fFdYUwwfJ5xb1M3L4E3d=-HZ=nXK_ETtA@mail.gmail.com>
On 9.16.4. JSON_TABLE
`
name type FORMAT JSON [ENCODING UTF8] [ PATH json_path_specification ]
Inserts a composite SQL/JSON item into the output row
`
i am not sure "Inserts a composite SQL/JSON item into the output row"
I think it means, for any type's typecategory is TYPCATEGORY_STRING,
if FORMAT JSON is specified explicitly, the output value (text type)
will be legal
json type representation.
I also did a minor refactor on JSON_VALUE_OP, jsexpr->omit_quotes.
Attachments:
[application/x-patch] minor_fix_v38.diff (1023B, ../CACJufxHUV-rOFex=VTLO-5y0y2gUg6LFQw59HFHUpZZxbcHEeQ@mail.gmail.com/2-minor_fix_v38.diff)
download | inline diff:
diff --git a/src/backend/executor/execExpr.c b/src/backend/executor/execExpr.c
index 74bc6f49..56ab12ac 100644
--- a/src/backend/executor/execExpr.c
+++ b/src/backend/executor/execExpr.c
@@ -4289,7 +4289,7 @@ ExecInitJsonExpr(JsonExpr *jexpr, ExprState *state,
* nodes.
*/
jsestate->escontext.type = T_ErrorSaveContext;
- if (jexpr->result_coercion || jexpr->omit_quotes)
+ if (jexpr->result_coercion)
{
jsestate->jump_eval_result_coercion =
ExecInitJsonExprCoercion(state, jexpr->result_coercion,
diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c
index 31c0847e..9802b4ae 100644
--- a/src/backend/parser/parse_expr.c
+++ b/src/backend/parser/parse_expr.c
@@ -4363,6 +4363,7 @@ transformJsonFuncExpr(ParseState *pstate, JsonFuncExpr *func)
jsexpr->returning->format->format_type = JS_FORMAT_DEFAULT;
jsexpr->returning->format->encoding = JS_ENC_DEFAULT;
+ jsexpr->omit_quotes = true;
jsexpr->result_coercion = coerceJsonFuncExprOutput(pstate, jsexpr);
/*
[application/octet-stream] v1-0001-refactor-sqljson_jsontable-related-tests.no-cfbot (25.7K, ../CACJufxHUV-rOFex=VTLO-5y0y2gUg6LFQw59HFHUpZZxbcHEeQ@mail.gmail.com/3-v1-0001-refactor-sqljson_jsontable-related-tests.no-cfbot)
download
view thread (27+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Subject: Re: remaining sql/json patches
In-Reply-To: <CACJufxHUV-rOFex=VTLO-5y0y2gUg6LFQw59HFHUpZZxbcHEeQ@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox