Re: Undocumented array_val[generate_series(...)] functionality? - Mailing list pgsql-general

From David Rowley
Subject Re: Undocumented array_val[generate_series(...)] functionality?
Date
Msg-id CAApHDvpWEqS_1OdHLT9X_7YfZuK91mwRFWsmE0LoY4cf-8VJ-A@mail.gmail.com
Whole thread Raw
In response to Re: Undocumented array_val[generate_series(...)] functionality?  ("David G. Johnston" <david.g.johnston@gmail.com>)
Responses Re: Undocumented array_val[generate_series(...)] functionality?  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-general
On Mon, 12 Jul 2021 at 12:58, David G. Johnston
<david.g.johnston@gmail.com> wrote:
>
> On Sun, Jul 11, 2021 at 5:43 PM David Rowley <dgrowleyml@gmail.com> wrote:
>>
>> Isn't this implied by "Each subscript is itself an expression"?
>> There's nothing special here with the SRF. That just produces 3 rows
>> and passes the subscript as 1, 2 then 3.
>>
>
> One can indeed infer that if the expression chosen for subscript is an SRF that the resultant output will also be an
SRF.

I'd say in your example the array with the subscript does not become
an SRF anymore than abs() becomes an SRF in the following:

select abs(generate_series(-3,-1));

abs() is simply called once per output value of the generate_series
SRF.  That seems fairly equivalent to me to what's going on in your
example case.

David



pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Undocumented array_val[generate_series(...)] functionality?
Next
From: Kyotaro Horiguchi
Date:
Subject: Re: Removing a subscription that does not exist