Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UGLdj-0003GB-Sl for pgsql-bugs@arkaria.postgresql.org; Fri, 15 Mar 2013 03:49:08 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UGLdj-0008Hj-9C for pgsql-bugs@arkaria.postgresql.org; Fri, 15 Mar 2013 03:49:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UGLdh-0008H1-FX for pgsql-bugs@postgresql.org; Fri, 15 Mar 2013 03:49:05 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UGLdf-0002ey-Fy for pgsql-bugs@postgresql.org; Fri, 15 Mar 2013 03:49:05 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id r2F3n1cT020847; Thu, 14 Mar 2013 23:49:01 -0400 (EDT) From: Tom Lane To: rikard@ngs.hr cc: pgsql-bugs@postgresql.org Subject: Re: BUG #7943: plpgsql parsing bug In-reply-to: References: Comments: In-reply-to rikard@ngs.hr message dated "Thu, 14 Mar 2013 19:36:00 -0000" Date: Thu, 14 Mar 2013 23:49:01 -0400 Message-ID: <20846.1363319341@sss.pgh.pa.us> X-Pg-Spam-Score: -4.3 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org rikard@ngs.hr writes: > The following bug has been logged on the website: > Bug reference: 7943 > Logged by: Rikard Pavelic > Email address: rikard@ngs.hr > PostgreSQL version: 9.2.1 > Operating system: Windows 7 > Description: > ERROR: "_t1" is not a scalar variable > LINE 12: for _i1, _i2, _t1, _t2, _t3, _b in select * from ( > ^ [ shrug ... ] It's right: _t1 is not a scalar variable. (It has the composite type s.) The reason this is problematic is that writing a composite variable as the target of a FOR IN SELECT loop is defined as assigning all the columns from the SELECT into fields of the composite variable. Which is not what you wanted to have happen there, even if we were to extend the definition to allow a mixture of scalar and composite variables in the target list. I'd suggest declaring a record variable and using that as the target. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs