From: Tom Lane <tgl@sss.pgh.pa.us>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: Brahmam Eswar <brahmam1234@gmail.com>
Cc: pgsql-general <pgsql-general@postgresql.org>
Subject: Re: How to store multiple rows in array .
Date: Sun, 19 Nov 2017 13:33:01 -0500
Message-ID: <11642.1511116381@sss.pgh.pa.us> (raw)
In-Reply-To: <CAFj8pRBmDcB_0nMQp4uiyV6XMZTh3xAhARRyiatR=7ZELyq0+g@mail.gmail.com>
References: <CA+wLFo2wXFyAmb26Qk8-HTELi0fb4Kr9-k0fAmJFYWh=xbDjZQ@mail.gmail.com>
<CAFj8pRBmDcB_0nMQp4uiyV6XMZTh3xAhARRyiatR=7ZELyq0+g@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-general>
Pavel Stehule <pavel.stehule@gmail.com> writes:
> 2017-11-19 18:57 GMT+01:00 Brahmam Eswar <brahmam1234@gmail.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
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general
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, pavel.stehule@gmail.com, brahmam1234@gmail.com
Subject: Re: How to store multiple rows in array .
In-Reply-To: <11642.1511116381@sss.pgh.pa.us>
References: <CA+wLFo2wXFyAmb26Qk8-HTELi0fb4Kr9-k0fAmJFYWh=xbDjZQ@mail.gmail.com> <CAFj8pRBmDcB_0nMQp4uiyV6XMZTh3xAhARRyiatR=7ZELyq0+g@mail.gmail.com> <11642.1511116381@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