Re: Prepared statement already exists

From: "Scott Marlowe" <scott(dot)marlowe(at)gmail(dot)com>
To: Chris <dmagick(at)gmail(dot)com>
Cc: "Richard Huxton" <dev(at)archonet(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Prepared statement already exists
Date: 2008-12-10 04:34:28
Message-ID: dcc563d10812092034i6ace5ec1va62b31a3960cbaa7@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Dec 9, 2008 at 8:59 PM, Chris <dmagick(at)gmail(dot)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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Liraz Siri 2008-12-10 07:38:20 Re: creating a specialized version of turnkey postgresql (Re: adding postgis support to turnkey postgresql)
Previous Message Liraz Siri 2008-12-10 04:29:36 Re: Ubuntu for servers (was TurnKey PostgreSQL)