Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 54D799FB26B for ; Thu, 11 Jan 2007 20:38:15 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-new, port 10024) with ESMTP id 85070-08 for ; Thu, 11 Jan 2007 20:37:53 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from lists.commandprompt.com (host-254.commandprompt.net [207.173.203.254]) by postgresql.org (Postfix) with ESMTP id 5E7A89FB269 for ; Thu, 11 Jan 2007 20:37:58 -0400 (AST) Received: from perhan.alvh.no-ip.org (200-126-100-202.bk7-dsl.surnet.cl [200.126.100.202]) (authenticated bits=0) by lists.commandprompt.com (8.13.7/8.13.6) with ESMTP id l0C0akVU011034; Thu, 11 Jan 2007 16:36:51 -0800 Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 7EB4332A02; Thu, 11 Jan 2007 21:36:41 -0300 (CLST) Date: Thu, 11 Jan 2007 21:36:41 -0300 From: Alvaro Herrera To: Jan van der Weijde Cc: pgsql-interfaces@postgresql.org Subject: Re: How do I detect End-of-table or End-of-limit ? Message-ID: <20070112003641.GI10464@alvh.no-ip.org> Mail-Followup-To: Jan van der Weijde , pgsql-interfaces@postgresql.org References: <4B9C73D1EB78FE4A81475AE8A553B3C67DC52B@exch-lei1.attachmate.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4B9C73D1EB78FE4A81475AE8A553B3C67DC52B@exch-lei1.attachmate.com> User-Agent: Mutt/1.5.13 (2006-08-11) X-Virus-Scanned: ClamAV version 0.88.5, clamav-milter version 0.88.5 on projects.commandprompt.com X-Virus-Status: Clean X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by milter-greylist-1.6 (lists.commandprompt.com [192.168.2.159]); Thu, 11 Jan 2007 16:36:51 -0800 (PST) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/15 X-Sequence-Number: 6393 Jan van der Weijde wrote: > However I am looking for something more elegant like a status flag in > libpq that indicate EOF or End-Of-limit. I don't think there's an actual "EOF". What you see is an "end of tuples in the result set". Whether it is because you ran into the LIMIT, or because you fell off the end of the table, you can't tell (nor can the server actually). Maybe it's more appropriate for you to open a cursor for the whole table, and then do FETCH from it until it runs out of tuples; you will know then that it's the end of the table. -- Alvaro Herrera http://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc.