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.