Re: Prepared statement already exists - Mailing list pgsql-general

From Scott Marlowe
Subject Re: Prepared statement already exists
Date
Msg-id dcc563d10812092034i6ace5ec1va62b31a3960cbaa7@mail.gmail.com
Whole thread Raw
In response to Re: Prepared statement already exists  (Chris <dmagick@gmail.com>)
List pgsql-general
On Tue, Dec 9, 2008 at 8:59 PM, Chris <dmagick@gmail.com> wrote:
> Richard Huxton wrote:
>>
>> WireSpot wrote:
>>>
>>> This mechanism is still not perfect. Technically it is still possible
>>> for race conditions to appear. Apparently (in PHP at least) pg_connect
>>> does persistent connections by default.
>>
>> Nope - pg_pconnect() does that. Multiple calls to pg_connect() within
>> the same script will give the same connection though.
>
> IFF you supply exactly the same details (db/host/port, user, pass) - if any
> are different you'll get a new connection.

There's a bool arg you can throw at the connection to stop that.

From the pg_connect page:

If a second call is made to pg_connect() with the same
connection_string as an existing connection, the existing connection
will be returned unless you pass PGSQL_CONNECT_FORCE_NEW as
connect_type .

It's not like the behaviour is hidden or something.

pgsql-general by date:

Previous
From: Liraz Siri
Date:
Subject: Re: Ubuntu for servers (was TurnKey PostgreSQL)
Next
From: Liraz Siri
Date:
Subject: Re: creating a specialized version of turnkey postgresql (Re: adding postgis support to turnkey postgresql)