Re: Undocumented array_val[generate_series(...)] functionality?

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Undocumented array_val[generate_series(...)] functionality?
Date: 2021-07-12 01:06:09
Message-ID: CAApHDvpWEqS_1OdHLT9X_7YfZuK91mwRFWsmE0LoY4cf-8VJ-A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 12 Jul 2021 at 12:58, David G. Johnston
<david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
>
> On Sun, Jul 11, 2021 at 5:43 PM David Rowley <dgrowleyml(at)gmail(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Kyotaro Horiguchi 2021-07-12 01:38:01 Re: Removing a subscription that does not exist
Previous Message David G. Johnston 2021-07-12 00:58:14 Re: Undocumented array_val[generate_series(...)] functionality?