Re: using CURSOR with PHP

From: Keary Suska <hierophant(at)pcisys(dot)net>
To: Postgres-PHP <pgsql-php(at)postgresql(dot)org>
Subject: Re: using CURSOR with PHP
Date: 2002-05-28 19:53:09
Message-ID: B9193C45.EE44%hierophant@pcisys.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-php

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)."

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"

In response to

Responses

Browse pgsql-php by date

  From Date Subject
Next Message Andrew McMillan 2002-05-29 02:10:50 Re: using CURSOR with PHP
Previous Message Eckhard Hoeffner 2002-05-28 16:47:17 Re: using CURSOR with PHP