Skip site navigation (1) Skip section navigation (2)

PostgreSQL and PHP persistent connections

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: "Thies C(dot) Arntzen" <thies(at)digicol(dot)de>
Cc: Rasmus(at)candle(dot)pha(dot)pa(dot)us, Lerdorf <rasmus(at)php(dot)net>, PostgreSQL-interfaces <pgsql-interfaces(at)postgresql(dot)org>
Subject: PostgreSQL and PHP persistent connections
Date: 2001-02-07 19:12:26
Message-ID: 200102071912.OAA27530@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-interfacespgsql-jdbc
Thies, we talked at LinuxWorld about improving the reliability of
persistent PostgreSQL connections in PHP.

I believe the problem is that persistent connections sometime do not
pass clean sessions because of open transactions and SET changes to the
session.

We discussed using 'ROLLBACK' before passing a connection to a new user,
but the problem was that ROLLBACK with no open transaction causes a
server log error message.  We discussed adding 'ROLLBACK SILENT' to fix
this, but I believe a better, more portable solution is a simple "BEGIN
WORK;ROLLBACK".  This will do nothing if there is no open transaction,
and will ROLLBACK any open transaction.  I propose this be sent by PHP
as the first query when passing persistent connections.

As far as SET changes, does anyone on the PostgreSQL interfaces list
have a suggestion on how to RESET all session parameters?  Seems we may
need to add this feature in to the backend.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Responses

pgsql-interfaces by date

Next:From: Peter EisentrautDate: 2001-02-07 19:20:16
Subject: Re: pgAccess fails to launch on HPUX
Previous:From: Ross J. ReedstromDate: 2001-02-07 18:49:13
Subject: Re: [INTERFACES] pgAccess fails to launch on HPUX

pgsql-jdbc by date

Next:From: Thies C. ArntzenDate: 2001-02-07 19:56:12
Subject: Re: PostgreSQL and PHP persistent connections
Previous:From: Dror MatalonDate: 2001-02-07 17:32:13
Subject: Re: Re: [INTERFACES] Q on JDBC's resultset

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group