X-Original-To: pgsql-interfaces-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id D6EAB11F65DD for ; Fri, 31 Mar 2006 19:56:22 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 61683-02 for ; Fri, 31 Mar 2006 19:56:22 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id C919311F621C for ; Fri, 31 Mar 2006 19:56:20 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k2VNu8u3005577; Fri, 31 Mar 2006 18:56:08 -0500 (EST) To: Keary Suska cc: Postgres-Interfaces Subject: Re: Asynchronous Queries/libpq In-reply-to: References: Comments: In-reply-to Keary Suska message dated "Fri, 31 Mar 2006 12:56:13 -0700" Date: Fri, 31 Mar 2006 18:56:08 -0500 Message-ID: <5576.1143849368@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.114 required=5 tests=[AWL=0.114] X-Spam-Score: 0.114 X-Spam-Level: X-Archive-Number: 200603/35 X-Sequence-Number: 6091 Keary Suska writes: > Is it that PQgetResult will return a full query result from a single > command, and will only return NULL if there are no more commands that have > not completed, therefore only needing to be called once per command in the > dispatched query; or is it that PQgetResult must be repeatedly called for > even a single command query, and that it will only return NULL after each > command in the dispatched query has completed fully? You need to loop until PQgetResult returns null, if you want to handle multi-command strings (you'll get one PGresult per command). If you know there's only going to be one result you might be able to get away without a second PQgetResult call, but I wouldn't recommend it. > Further, can we *always* assume that query results will be returned in the > order they appear in the query dispatch? Yes. The backend isn't going to execute commands in a query string out-of-order. regards, tom lane