Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mH73c-00057w-K9 for pgsql-novice@arkaria.postgresql.org; Fri, 20 Aug 2021 16:07:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mH73a-0002ZR-8n for pgsql-novice@arkaria.postgresql.org; Fri, 20 Aug 2021 16:07:46 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mH73a-0002ZJ-1X for pgsql-novice@lists.postgresql.org; Fri, 20 Aug 2021 16:07:46 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mH73X-0007Q9-Ue for pgsql-novice@postgresql.org; Fri, 20 Aug 2021 16:07:45 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 17KG7eJF1915561; Fri, 20 Aug 2021 12:07:40 -0400 From: Tom Lane To: Roger Mason cc: pgsql-novice@postgresql.org Subject: Re: plpgsql select into In-reply-to: References: <6af818d092cf9afb1f7228bca0cbab03ae17bf4d.camel@cybertec.at> Comments: In-reply-to Roger Mason message dated "Fri, 20 Aug 2021 13:04:20 -0230" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1915559.1629475660.1@sss.pgh.pa.us> Date: Fri, 20 Aug 2021 12:07:40 -0400 Message-ID: <1915560.1629475660@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Roger Mason writes: > Yes, if I omit the INTO clause I get data returned. So then how do I > insert the result of the plpgsql call into a table? This is what > happens if I try calling 'select into' in psql: > select into info_table from (select get_info('1043_1')) as info_split; > SELECT 1288 > test=> select * from info_table ; > -- > (1288 rows) You selected zero columns (which psql is not very good at displaying :-(). Try select * into info_table from (select get_info('1043_1')) as info_split; BTW, that could be simplified a lot: select * into info_table from get_info('1043_1'); regards, tom lane