X-Original-To: pgsql-sql-postgresql.org@postgresql.org Received: from localhost (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id C027F9FB250 for ; Thu, 20 Jul 2006 17:53:59 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.128]) (amavisd-new, port 10024) with ESMTP id 53306-04-5 for ; Thu, 20 Jul 2006 20:53:44 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey- Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by postgresql.org (Postfix) with ESMTP id CD44C9FB36C for ; Thu, 20 Jul 2006 17:19:26 -0300 (ADT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 5BBE435129; Thu, 20 Jul 2006 13:19:25 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 59DB335115; Thu, 20 Jul 2006 13:19:25 -0700 (PDT) Date: Thu, 20 Jul 2006 13:19:25 -0700 (PDT) From: Stephan Szabo To: Kevin Nikiforuk Cc: pgsql-sql@postgresql.org Subject: Re: Error when trying to use a FOR loop In-Reply-To: <6EA72AC41F81D242A38AAF505523A94D022DF2@kappa.acrodex.net> Message-ID: <20060720131715.M89811@megazone.bigpanda.com> References: <6EA72AC41F81D242A38AAF505523A94D022DF2@kappa.acrodex.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests= X-Spam-Level: X-Archive-Number: 200607/265 X-Sequence-Number: 25839 On Thu, 20 Jul 2006, Kevin Nikiforuk wrote: > Sorry if this is in the archives, but I've done a search and couldn't > find anything relevant. I'm running HP's precompiled version of 8.1.3.1 > as part of their Internet Express offering, and I can't seem to run a > for loop. Here's what I'm seeing: > > xp512-0715-0716=# FOR LV in 1..10 LOOP > > xp512-0715-0716-# select * from ldevrg; > > ERROR: syntax error at or near "FOR" at character 1 > > LINE 1: FOR LV in 1..10 LOOP I think the problem is that the FOR is a pl/pgsql construct and isn't allowed in straight sql contexts but only inside a function.