Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 050F6633E2F for ; Wed, 19 Aug 2009 12:12:46 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 45237-07 for ; Wed, 19 Aug 2009 15:12:41 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from smtp-vbr7.xs4all.nl (smtp-vbr7.xs4all.nl [194.109.24.27]) by mail.postgresql.org (Postfix) with ESMTP id A19136337AB for ; Wed, 19 Aug 2009 12:12:40 -0300 (ADT) Received: from [0.0.0.0] ([80.101.116.150]) by smtp-vbr7.xs4all.nl (8.13.8/8.13.8) with ESMTP id n7JFCT2W051480 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 19 Aug 2009 17:12:36 +0200 (CEST) (envelope-from yeb.havinga@portavita.nl) Message-ID: <4A8C170C.1050703@portavita.nl> Date: Wed, 19 Aug 2009 17:15:24 +0200 From: Yeb Havinga Reply-To: y.t.havinga@mgrid.net User-Agent: Thunderbird 2.0.0.22 (Windows/20090605) MIME-Version: 1.0 To: Craig Ringer CC: pgsql-sql@postgresql.org Subject: Re: Multiple simultaneous queries on single connection References: <4A8951C5.5030107@portavita.nl> <4A8B56E2.6050704@postnewspapers.com.au> In-Reply-To: <4A8B56E2.6050704@postnewspapers.com.au> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by XS4ALL Virus Scanner X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200908/106 X-Sequence-Number: 33015 Hello Craig, list >> Is there a way to have two or more connections see each others >> uncommitted things? > > Not at present. > > You should be able to use explicitly declared cursors and FETCH to > interleave requests for results from one or more queries in the same > transation using the one connection, but only one FETCH may be active > at a time. Thanks for your info. I verified with a pl/pgsql function that from a pl/pgsql perspective, this is a good solution. However, our client application needs to access the postgres backend with libpq. I'm currently looking at PQsendPrepare / PQSendQueryPrepared together with what the exec_execute_message does. Each of these has a portal name as parameter. It would be nice if PQgetResult could also provide a portal name to fetch a result from. The question is how to multiplex data from different portals on the tcp/ip connection, or maybe have more than one tcp/ip connection per PQconn object when more than one portal is active at the same time. -- Yeb