From: Ron <ronljohnsonjr@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Converting row elements into a arrays?
Date: Thu, 2 Mar 2023 15:49:13 -0600
Message-ID: <36f53642-db43-4fc9-028e-8b6cd3dff9b4@gmail.com> (raw)
In-Reply-To: <e994b049-93f1-d739-e74c-ecd29bbbe4c5@gmail.com>
References: <788ab733-d0d1-7791-fb22-7c2724b08816@gmail.com>
<e994b049-93f1-d739-e74c-ecd29bbbe4c5@gmail.com>
On 3/2/23 15:45, Rob Sargent wrote:
> On 3/2/23 13:58, Ron wrote:
>> Postgresql 12.13
>>
>> Given the sample below, I'm looking for how to generate this output.
>> It's like GROUP BY, but generating an array instead of an aggreate number.
>> f1 | f2_array
>> ----+---------
>> 1 | {1,2,3}
>> 2 | {1,2,3,4}
>> 3 | {1,2}
>>
>> The ultimate goal is to somehow use pg_index.indkey to get column names
>> from pg_attribute.
>>
>> create table foo (f1 int, f2 int);
>> insert into foo values (1, 1);
>> insert into foo values (1, 2);
>>
[snip]
>
> In which environment are you accessing that array? psql only?
Correct.
--
Born in Arizona, moved to Babylonia.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: ronljohnsonjr@gmail.com
Subject: Re: Converting row elements into a arrays?
In-Reply-To: <36f53642-db43-4fc9-028e-8b6cd3dff9b4@gmail.com>
References: <788ab733-d0d1-7791-fb22-7c2724b08816@gmail.com> <e994b049-93f1-d739-e74c-ecd29bbbe4c5@gmail.com> <36f53642-db43-4fc9-028e-8b6cd3dff9b4@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox