From: | Amit Langote <amitlangote09(at)gmail(dot)com> |
---|---|
To: | jian he <jian(dot)universality(at)gmail(dot)com> |
Cc: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>, Himanshu Upadhyaya <upadhyaya(dot)himanshu(at)gmail(dot)com>, Erik Rijkers <er(at)xs4all(dot)nl>, Andres Freund <andres(at)anarazel(dot)de>, Andrew Dunstan <andrew(at)dunslane(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: remaining sql/json patches |
Date: | 2024-04-03 12:38:59 |
Message-ID: | CA+HiwqGT9X4VcTuiM2s0By+R6V31FtTXd2XpofM5o+LWss9-eQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Apr 3, 2024 at 4:16 PM jian he <jian(dot)universality(at)gmail(dot)com> wrote:
> On Wed, Apr 3, 2024 at 11:30 AM jian he <jian(dot)universality(at)gmail(dot)com> wrote:
> >
> > On Tue, Apr 2, 2024 at 9:57 PM Amit Langote <amitlangote09(at)gmail(dot)com> wrote:
> > >
> > > Please let me know if you have further comments on 0001. I'd like to
> > > get that in before spending more energy on 0002.
> > >
>
> -- a/src/backend/parser/parse_target.c
> +++ b/src/backend/parser/parse_target.c
> @@ -2019,6 +2019,9 @@ FigureColnameInternal(Node *node, char **name)
> case JSON_VALUE_OP:
> *name = "json_value";
> return 2;
> + case JSON_TABLE_OP:
> + *name = "json_table";
> + return 2;
> default:
> elog(ERROR, "unrecognized JsonExpr op: %d",
> (int) ((JsonFuncExpr *) node)->op);
>
> "case JSON_TABLE_OP part", no need?
> json_table output must provide column name and type?
That seems to be the case, so removed.
> I did some minor refactor transformJsonTableColumns, make the comments
> align with the function intention.
Thanks, but that seems a bit verbose. I've reduced it down to what
gives enough information.
> in v48-0001, in transformJsonTableColumns we can `Assert(rawc->name);`.
> since non-nested JsonTableColumn must specify column name.
> in v48-0002, we can change to `if (rawc->coltype != JTC_NESTED)
> Assert(rawc->name);`
Ok, done.
> SELECT * FROM JSON_TABLE(jsonb '1', '$' COLUMNS (a int PATH '$.a' )
> ERROR ON ERROR) jt;
> ERROR: no SQL/JSON item
>
> I thought it should just return NULL.
> In this case, I thought that
> (not column-level) ERROR ON ERROR should not interfere with "COLUMNS
> (a int PATH '$.a' )".
I think it does in another database's implementation, which must be
why the original authors decided that the table-level ERROR should
also be used for columns unless overridden. But I agree that keeping
the two separate is better, so changed that way.
Attached updated patches. I have addressed your doc comments on 0001,
but not 0002 yet.
>
> +-- Other miscellanous checks
> "miscellanous" should be "miscellaneous".
>
>
> overall the coverage is pretty high.
> the current test output looks fine.
--
Thanks, Amit Langote
Attachment | Content-Type | Size |
---|---|---|
v49-0002-JSON_TABLE-Add-support-for-NESTED-columns.patch | application/octet-stream | 49.7 KB |
v49-0001-Add-JSON_TABLE-function.patch | application/octet-stream | 133.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Heikki Linnakangas | 2024-04-03 12:39:55 | Re: Combine Prune and Freeze records emitted by vacuum |
Previous Message | Bharath Rupireddy | 2024-04-03 12:25:27 | Re: New Table Access Methods for Multi and Single Inserts |