Re: How to store multiple rows in array .

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: Brahmam Eswar <brahmam1234(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to store multiple rows in array .
Date: 2017-11-19 18:33:01
Message-ID: 11642.1511116381@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> writes:
> 2017-11-19 18:57 GMT+01:00 Brahmam Eswar <brahmam1234(at)gmail(dot)com>:
>> How to collect multiple columns into array which is composite data type of
>> all select colums

> SELECT ARRAY(SELECT ROW(col1, col2, ...) INTO

You probably need an explicit cast to the rowtype. That is,

declare myarray rowtypename[];
...
select array(select row(col1, ...)::rowtypename from ...) into myarray;

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2017-11-19 18:41:13 Re: parallel query in 9.6.6 + oracle_fdw -> ERROR: invalid cache ID: 41
Previous Message Chris Mair 2017-11-19 18:18:04 parallel query in 9.6.6 + oracle_fdw -> ERROR: invalid cache ID: 41