From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
---|---|
To: | Bryn Llewellyn <bryn(at)yugabyte(dot)com>, pgsql-general list <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Where's the doc for "array()" — as in "select array(values (17), (42))" |
Date: | 2022-09-18 20:29:31 |
Message-ID: | e6ac86e5-39f4-9704-7260-3f6c40c63b2d@aklaver.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 9/18/22 13:25, Bryn Llewellyn wrote:
> I noticed that "array()" is used in the query that implements the "\du"
> psql meta-command. It has some similarity with "array_agg()" thus:
>
> create temporary view x(v) as (values (17), (42));
> select array_agg(v) from x;
> select array(select v from x);
>
> Anyway, I can't find where "array()" is documented. Google does find me
> a hit on stackexchange.com <http://stackexchange.com>. But it doesn't
> x-ref to the PG doc.
https://www.postgresql.org/docs/current/sql-expressions.html
4.2.12. Array Constructors
"It is also possible to construct an array from the results of a
subquery. In this form, the array constructor is written with the key
word ARRAY followed by a parenthesized (not bracketed) subquery. For
example:
SELECT ARRAY(SELECT oid FROM pg_proc WHERE proname LIKE 'bytea%');
..."
--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2022-09-18 21:29:30 | Re: Where's the doc for "array()" — as in "select array(values (17), (42))" |
Previous Message | Bryn Llewellyn | 2022-09-18 20:25:03 | Where's the doc for "array()" — as in "select array(values (17), (42))" |