From: Arthur Zakirov <a.zakirov@postgrespro.ru>
To: Dmitry Dolgov <9erthalion6@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: David Steele <david@pgmasters.net>
Cc: peter.eisentraut@2ndquadrant.com, PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: [PATCH] Generic type subscripting
Date: Wed, 29 Mar 2017 20:14:27 +0300
Message-ID: <38e32275-91f2-61e9-24dd-57135a662c41@postgrespro.ru> (raw)
In-Reply-To: <CA+q6zcXsonX+qLhf2crQgj14NzJmcibABhyVch1kjNtSL1+V1A@mail.gmail.com>
References: <CA+q6zcVovR+XY4mfk-7oNk-rF91gH0PebnNfuUjuuDsyHjOcVA@mail.gmail.com>
<20423.1489533013@sss.pgh.pa.us>
<393cd0ae-5b84-849e-fc73-7077470a009e@pgmasters.net>
<CA+q6zcUX=Om75kgZXkpYPhnwUCo4osFpzd83dKPzjSGfCmxEgA@mail.gmail.com>
<65df4a65-a9d8-3531-5baf-edb237771f0e@pgmasters.net>
<22355.1490369372@sss.pgh.pa.us>
<449f42b9-f338-9e45-cb33-3e15c7b547ad@postgrespro.ru>
<CA+q6zcWFLpEX6H1LOOKFJMAN+LB+mmEx=6Syd4WVioXkbXq32A@mail.gmail.com>
<c7cc0592-4c9b-699d-3b61-810804759de6@postgrespro.ru>
<CA+q6zcXQ9UO0_qGqoFgd_4ymKYxwr-3he+abEbnWaPk2nbmPVQ@mail.gmail.com>
<CA+q6zcXsonX+qLhf2crQgj14NzJmcibABhyVch1kjNtSL1+V1A@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
On 28.03.2017 19:31, Dmitry Dolgov wrote:
> On 28 March 2017 at 12:08, Dmitry Dolgov <9erthalion6@gmail.com
> <mailto:9erthalion6@gmail.com>> wrote:
>>
>> Wow, I didn't notice that, sorry - will fix it shortly.
>
> So, here is the corrected version of the patch.
I have some picky comments.
I'm not sure that "typsbsparse" is better than "typsubscripting" or
"typsubparse". Maybe "typsubsparse"?
> <row>
> + <entry><structfield>typsubscripting</structfield></entry>
> + <entry><type>regproc</type></entry>
Here you didn't fix "typsubscripting" to new name.
> + <title>JSON subscripting</title>
> + <para>
> + JSONB data type support array-style subscripting expressions to extract or update particular element. An example of subscripting syntax:
Should be "JSONB data type supports".
> + to handle subscripting expressions. It should contains logic for verification
> + and decide which function must be used for evaluation of this expression.
> + For instance:
Should be "It should contain".
> + <sect2 id="json-subscripting">
> + <title>JSON subscripting</title>
> + <para>
> + JSONB data type support array-style subscripting expressions to extract or update particular element. An example of subscripting syntax:
You have implemented jsonb subscripting. The documentation should be
fixed to:
+ <sect2 id="jsonb-subscripting">
+ <title><type>jsonb</> Subscripting</title>
+ <para>
+ <type>jsonb</> data type support array-style subscripting
expressions to extract or update particular element. An example of
subscripting syntax:
I think IsOneOf() macros should be removed. Since it is not used anywhere.
> + Assert(subexpr != NULL);
> +
> + if (subexpr == NULL)
> + ereport(ERROR,
> + (errcode(ERRCODE_DATATYPE_MISMATCH),
> + errmsg("jsonb subscript does not support slices"),
> + parser_errposition(pstate, exprLocation(
> + ((Node *) lfirst(sbsref->refupperindexpr->head))))));
Here one of the conditions is excess. Better to delete assert condition
I think.
I've tried tests from message [1]. They looks good. Performance looks
similar for subscripting without patch and with patch.
I wanted to implement subscripting for ltree or hstore extensions.
Subscripting for ltree looks more interesting. Especially with slicing.
But I haven't done it yet. I hope that I will implement it tomorrow.
1.
https://www.postgresql.org/message-id/CAKNkYnz_WWkzzxyFx934N%3DEp47CAFju-Rk-sGeZo0ui8QdrGmw%40mail.g...
--
Arthur Zakirov
Postgres Professional: http://www.postgrespro.com
Russian Postgres Company
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
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: pgsql-hackers@postgresql.org
Cc: a.zakirov@postgrespro.ru, 9erthalion6@gmail.com, tgl@sss.pgh.pa.us, david@pgmasters.net
Subject: Re: [PATCH] Generic type subscripting
In-Reply-To: <38e32275-91f2-61e9-24dd-57135a662c41@postgrespro.ru>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox