Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 4FD289FB584 for ; Wed, 25 Apr 2007 10:38:25 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 51069-01 for ; Wed, 25 Apr 2007 10:38:15 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from a2s5.a2hosting.com (a2s5.a2hosting.com [209.124.50.10]) by postgresql.org (Postfix) with ESMTP id 669CF9FB1E7 for ; Wed, 25 Apr 2007 10:38:21 -0300 (ADT) Received: from adsl-153-119-143.tys.bellsouth.net ([70.153.119.143] helo=[192.168.1.12]) by a2s5.a2hosting.com with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.63) (envelope-from ) id 1HghhH-0006Ki-Pk; Wed, 25 Apr 2007 09:38:16 -0400 In-Reply-To: <1177447321.17092.9.camel@MSI1036> References: <1177447321.17092.9.camel@MSI1036> Mime-Version: 1.0 (Apple Message framework v752.3) Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed Message-Id: <965E504A-7301-4531-B381-A1EEEB539344@pgedit.com> Cc: pgsql-sql@postgresql.org Content-Transfer-Encoding: 7bit From: John DeSoi Subject: Re: plpgsql array looping Date: Wed, 25 Apr 2007 09:38:09 -0400 To: Richard Albright X-Mailer: Apple Mail (2.752.3) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - a2s5.a2hosting.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - pgedit.com X-Source: X-Source-Args: X-Source-Dir: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200704/243 X-Sequence-Number: 28243 One problem (unless you intend to only look at every other element) is that you are incrementing idxptr explicitly in your loop. The FOR loop does that for you. This is the reason your output shows only even values. John On Apr 24, 2007, at 4:42 PM, Richard Albright wrote: > for idxptr in 1 .. array_upper(p_idxarray, 1) > loop > exit when p_idxarray[idxptr] >= p_idx; > idxptr := idxptr +1; > raise notice 'idx ptr: %', idxptr; > end loop; John DeSoi, Ph.D. http://pgedit.com/ Power Tools for PostgreSQL