Re: [PATCH] Generic type subscripting - Mailing list pgsql-hackers

From Arthur Zakirov
Subject Re: [PATCH] Generic type subscripting
Date
Msg-id CAKNkYnzpMwx0KtLCaOoFVGQZoJHJ5E+mTrZGEcary0eKu2LdLg@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] Generic type subscripting  (Dmitry Dolgov <9erthalion6@gmail.com>)
List pgsql-hackers
2017-03-28 19:31 GMT+03:00 Dmitry Dolgov <9erthalion6@gmail.com>:
> On 28 March 2017 at 12:08, Dmitry Dolgov <9erthalion6@gmail.com> wrote:
>>
>> Wow, I didn't notice that, sorry - will fix it shortly.
>
> So, here is the corrected version of the patch.

Thank you!

The patch looks good to me. But it is not applied :) I think it is
because of new FTS functions for jsonb. The patch need rebasing.

But, from my point of view, it would be nice if the code mentioned
earlier was improved:

> + foreach(l, sbsref->reflowerindexpr)
> + {
> + List *expr_ai = (List *) lfirst(l);
> + A_Indices *ai = (A_Indices *) lfirst(list_tail(expr_ai));
> +
> + subexpr = (Node *) lfirst(list_head(expr_ai));

It is necessary for arrays of course because of logic mentioned in the
documentation.

> If any dimension is written as a slice, i.e., contains a colon, then all dimensions are treated as slices. Any
dimensionthat has only a single number (no colon) is treated as being from 1 to the number specified.
 

But it would be better if SubscriptingRef structure had a new field of
List type. This field can store list of booleans, which means is there
slices or not. I think it can improve readability of the code.

-- 
Arthur Zakirov
Postgres Professional: http://www.postgrespro.com
Russian Postgres Company



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: BRIN de-summarize ranges
Next
From: Andrew Dunstan
Date:
Subject: Re: [PATCH] few fts functions for jsonb