Re: incomplete transaction keeps table locked? - Mailing list pgsql-general

From Richard Huxton
Subject Re: incomplete transaction keeps table locked?
Date
Msg-id 004401c0e365$aba39380$1001a8c0@archonet.com
Whole thread Raw
In response to incomplete transaction keeps table locked?  (gherson@snet.net (George Herson))
List pgsql-general
From: "George Herson" <gherson@snet.net>

> Hi. I'm running PostgreSQL 7.0.2 on Linux 2.2.14, i686.
>
> Are there any circumstances when exiting a PHP web script
> where you've started a transaction (with Begin Work) but haven't
explicitly
> done a Commit Work or Rollback before it ends will lock you out of
> a table (until you restart postgresql)?  I wouldn't do this normally but i
> was commenting out different portions of the PHP script in question to
isolate
> a bug in my code.  Does Postgres somehow get notified when a PHP script
ends
> so it knows to end a transaction in progress?  If not, how can i ensure a
> clean slate before attempting more sql commands in the next running of a
PHP
> script?

You using persistent connections? If so, Apache+PHP will keep connections
hanging around and PG doesn't know your session is finished. See mail
archives for details and the latest 4.0.x release (4/5?) changelog for
details.

If you're not using persistent connections you've got problems since PHP
should be clearing down the connection at the end of each request.

- Richard Huxton


pgsql-general by date:

Previous
From: "Richard Huxton"
Date:
Subject: Re: Re: Select statement
Next
From: "Richard Huxton"
Date:
Subject: Re: NOTIFY/LISTEN Using Embedded SQL (ecpg)