Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eGUP0-0000dw-Au for pgsql-general@arkaria.postgresql.org; Sun, 19 Nov 2017 18:33:10 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1eGUOy-0000hk-EG for pgsql-general@arkaria.postgresql.org; Sun, 19 Nov 2017 18:33:08 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1eGUOv-0000gI-OI for pgsql-general@postgresql.org; Sun, 19 Nov 2017 18:33:05 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eGUOs-0003gI-St for pgsql-general@postgresql.org; Sun, 19 Nov 2017 18:33:03 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id vAJIX1jj011643; Sun, 19 Nov 2017 13:33:01 -0500 From: Tom Lane To: Pavel Stehule cc: Brahmam Eswar , pgsql-general Subject: Re: How to store multiple rows in array . In-reply-to: References: Comments: In-reply-to Pavel Stehule message dated "Sun, 19 Nov 2017 18:59:47 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <11641.1511116381.1@sss.pgh.pa.us> Date: Sun, 19 Nov 2017 13:33:01 -0500 Message-ID: <11642.1511116381@sss.pgh.pa.us> List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org Pavel Stehule writes: > 2017-11-19 18:57 GMT+01:00 Brahmam Eswar : >> 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