From: Tom Lane <tgl@sss.pgh.pa.us>
To: Thomas Kellerer <spam_eater@gmx.net>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: How to split an array into columns
Date: Fri, 24 Aug 2018 09:41:04 -0400
Message-ID: <25445.1535118064@sss.pgh.pa.us> (raw)
In-Reply-To: <e61c1c80-19e4-6403-a4d5-f9b18c50988d@gmx.net>
References: <tencent_457E571D2754843359EF7ABA@qq.com>
<e61c1c80-19e4-6403-a4d5-f9b18c50988d@gmx.net>
Thomas Kellerer <spam_eater@gmx.net> writes:
> Maybe I am missing something, but:
> select id, data[1], data[2]
> from the_table;
> will work just fine.
If the arrays are of varying length, unnest() might be what the OP
is looking for.
regards, tom lane
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: tgl@sss.pgh.pa.us, spam_eater@gmx.net
Subject: Re: How to split an array into columns
In-Reply-To: <25445.1535118064@sss.pgh.pa.us>
References: <tencent_457E571D2754843359EF7ABA@qq.com> <e61c1c80-19e4-6403-a4d5-f9b18c50988d@gmx.net> <25445.1535118064@sss.pgh.pa.us>
* 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