Re: using CURSOR with PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Tue, 28 May 2002, Keary Suska wrote:

> on 5/28/02 10:26 AM, marco@xxxxxx 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@xxxxxxxxxxxxxx
> 

.TM.
-- 
      ____/  ____/   /
     /      /       /			Marco Colombo
    ___/  ___  /   /		      Technical Manager
   /          /   /			 ESI s.r.l.
 _____/ _____/  _/		       Colombo@xxxxxx



[Index of Archives]     [Postgresql General]     [Postgresql Admin]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Yosemite Backpacking]     [Postgresql Jobs]

  Powered by Linux