Received: from sss.pgh.pa.us ([192.204.191.242]) by postgresql.org (8.11.3/8.11.4) with ESMTP id fAT694m20548 for ; Thu, 29 Nov 2001 01:09:04 -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 fAT68ak15772; Thu, 29 Nov 2001 01:08:37 -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: <20011128194857.G37828-100000@megazone23.bigpanda.com> References: <20011128194857.G37828-100000@megazone23.bigpanda.com> Comments: In-reply-to Stephan Szabo message dated "Wed, 28 Nov 2001 19:53:30 -0800" Date: Thu, 29 Nov 2001 01:08:36 -0500 Message-ID: <15769.1007014116@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200111/400 X-Sequence-Number: 5782 Stephan Szabo writes: > Something like the below seemed to make it work for me under > 7.2b3: Oh ... duh! I've been bit by that before myself. In the original, since the FOR loops were using integer variables (not record or rowtype variables as they should've), the plpgsql parser was expecting an integer FOR-loop. Which goes like FOR ivar IN expression .. expression LOOP stmts END LOOP; Evidently, somewhere around the END LOOP it realized that it was missing the .. part of the construct. I've mumbled before that it's bad form to be using the declared type of the FOR variable to drive the syntaxing of FOR loops --- poor error recovery and unhelpful error messages are exactly the reasons why. Not sure that this can easily be fixed, however. regards, tom lane