Received: from sss.pgh.pa.us ([192.204.191.242]) by postgresql.org (8.11.3/8.11.4) with ESMTP id fATH5Om77662 for ; Thu, 29 Nov 2001 12:05:24 -0500 (EST) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id fATH2tk19093; Thu, 29 Nov 2001 12:02:55 -0500 (EST) To: Stephan Szabo cc: =?us-ascii?Q?=22Johnny_J=F8rgensen=22?= , pgsql-sql@postgresql.org Subject: Re: PL/pgSQL loops? In-reply-to: <20011129073009.E43179-100000@megazone23.bigpanda.com> References: <20011129073009.E43179-100000@megazone23.bigpanda.com> Comments: In-reply-to Stephan Szabo message dated "Thu, 29 Nov 2001 08:09:48 -0800" Date: Thu, 29 Nov 2001 12:02:55 -0500 Message-ID: <19090.1007053375@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200111/413 X-Sequence-Number: 5795 Stephan Szabo writes: > In addition, this seems to work: > for intvar in 1 .. (select max(a) from a) LOOP > and this doesn't: > for intvar in 1 .. (select max(loop) from a) LOOP > and this does: > for intvar in (select max(loop) from a) .. 1 LOOP > I'm guessing that plpgsql doesn't want to try to determine if > an expression is valid and so just concats stuff to pass off, Correct ... > but that seems to mean that you need to double quote loop in > the second (which is somewhat unobvious). I would've expected it to count nested parentheses, at least. A quick look makes it appear that some places in plpgsql's gram.y do, and some don't. Ugh. regards, tom lane