Re: How to split an array into columns

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thomas Kellerer <spam_eater(at)gmx(dot)net>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: How to split an array into columns
Date: 2018-08-24 13:41:04
Message-ID: 25445.1535118064@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thomas Kellerer <spam_eater(at)gmx(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2018-08-24 14:01:47 Re: Hungarian collation in English Windows server
Previous Message Abhinav Mehta 2018-08-24 13:07:06 Re: PG-Sample | Error | Equality operator for type json