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
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces pgsql-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

Browse pgsql-interfaces by date

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

Browse pgsql-jdbc by date

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