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

Поиск
Список
Период
Сортировка
От David Rowley
Тема Re: Undocumented array_val[generate_series(...)] functionality?
Дата
Msg-id CAApHDvoRcyDFvvt+5Y3uNeuckaNhpLZg6jsBc2T3xWqL5iPAnQ@mail.gmail.com
обсуждение исходный текст
Ответ на Undocumented array_val[generate_series(...)] functionality?  ("David G. Johnston" <david.g.johnston@gmail.com>)
Ответы Re: Undocumented array_val[generate_series(...)] functionality?  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-general
On Mon, 12 Jul 2021 at 11:52, David G. Johnston
<david.g.johnston@gmail.com> wrote:
> A post over in Reddit had an expression form I've never seen before:
>
> select (array[1,2,3,4]::integer[])[generate_series(1, 3)];

> Looking at subscripting in the SQL syntax this example doesn't seem to be documented.
>
> https://www.postgresql.org/docs/current/sql-expressions.html#SQL-EXPRESSIONS-SUBSCRIPTS
>
> Is it documented somewhere else, and, regardless, shouldn't it be documented in the linked location?

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.

David



В списке pgsql-general по дате отправления:

Предыдущее
От: Rob Sargent
Дата:
Сообщение: Re: Undocumented array_val[generate_series(...)] functionality?
Следующее
От: "David G. Johnston"
Дата:
Сообщение: Re: Undocumented array_val[generate_series(...)] functionality?