Re: using CURSOR with PHP

From: Marco Colombo <marco(at)esi(dot)it>
To: Keary Suska <hierophant(at)pcisys(dot)net>
Cc: Postgres-PHP <pgsql-php(at)postgresql(dot)org>
Subject: Re: using CURSOR with PHP
Date: 2002-05-29 13:02:13
Message-ID: Pine.LNX.4.44.0205291420120.24472-100000@Megathlon.ESI
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

On Tue, 28 May 2002, Keary Suska wrote:

> on 5/28/02 10:26 AM, marco(at)esi(dot)it purportedly said:
>
> > Well, with HTTP keepalive, it may even keep the HTTP session open.
> > But the problem is that you can't relay on it.
> > Moreover, I suspect that PHP resets the SQL session when it performs
> > an pconnect (that means, it asks the SQL backend to abort uncommitted
> > transactions, drop TEMP relations, and so on).
>
> Actually, no. According to the docs:
>
> "Warning
> There are a couple of additional caveats to keep in mind when using
> persistent connections. One is that when using table locking on a persistent
> connection, if the script for whatever reason cannot release the lock, then
> subsequent scripts using the same connection will block indefinitely and may
> require that you either restart the httpd server or the database server.
> Another is that when using transactions, a transaction block will also carry
> over to the next script which uses that connection if script execution ends
> before the transaction block does. In either case, you can use
> register_shutdown_function() to register a simple cleanup function to unlock
> your tables or roll back your transactions. Better yet, avoid the problem
> entirely by not using persistent connections in scripts which use table
> locks or transactions (you can still use them elsewhere)."

Looks like that paragraph is missing from my local copy of the manual:
time to update it. B-)

Anyway, if PHP isn't able to reset the existing connection to an initial
state (just like a new one), it's a bug. Scripts shouldn't relay on
that (mis)behaviour, IMHO.

> I had heard that this auto-cleanup functionality was supposed to be added,
> and there is a directive "pgsql.auto_reset_persistent" that is undocumented,
> that perhaps implements this, but it may be considered experimental. Unless
> the docs aren't properly up to date, which is not uncommon.
>
>
> Keary Suska
> Esoteritech, Inc.
> "Leveraging Open Source for a better Internet"
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org
>

.TM.
--
____/ ____/ /
/ / / Marco Colombo
___/ ___ / / Technical Manager
/ / / ESI s.r.l.
_____/ _____/ _/ Colombo(at)ESI(dot)it

In response to

Browse pgsql-php by date

  From Date Subject
Next Message Jules Alberts 2002-05-29 14:46:15 variable visibility when using <a href></a>
Previous Message Andrew McMillan 2002-05-29 02:10:50 Re: using CURSOR with PHP