Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 13672475AAC for ; Sat, 28 Dec 2002 16:23:30 -0500 (EST) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id 7511E475956 for ; Sat, 28 Dec 2002 16:23:29 -0500 (EST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.6/8.12.6) with ESMTP id gBSLNSd0004677; Sat, 28 Dec 2002 16:23:28 -0500 (EST) To: Tim Hart Cc: pgsql-interfaces@postgresql.org Subject: Re: libpq and multiple selects in a single query In-reply-to: References: Comments: In-reply-to Tim Hart message dated "Sat, 28 Dec 2002 01:49:28 -0600" Date: Sat, 28 Dec 2002 16:23:27 -0500 Message-ID: <4676.1041110607@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/76 X-Sequence-Number: 3489 Tim Hart writes: > Would it be worth the effort to add to and/or modify the libpq API so > that multiple selects could be sent to the server in a single request > and response? You can do it already. See PQsendQuery and PQgetResult. http://www.ca.postgresql.org/users-lounge/docs/7.3/postgres/libpq-async.html mentions this specifically: PQexec can return only one PGresult structure. If the submitted command string contains multiple SQL commands, all but the last PGresult are discarded by PQexec. There is a lot of other cruft here to allow nonblocking interaction with the server, but if all you care about is multiple commands sent in a single string, you only need PQsendQuery(...); while ((res = PQgetResult(...))) { process result; PQclear(res); } regards, tom lane