Search Postgresql Archives

Re: open transaction?

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

 



On 29/12/2008 11:53, Raymond O'Donnell wrote:
> On 29/12/2008 11:48, blackwater dev wrote:
> 
>> Without thinking I closed by connection before committing or rolling
>> back my transaction.  Did postgres handle this for me?  How do I see if
>> the transaction is still open?
> 
> I'm reasonably sure that the transaction will get rolled back if the
> connection dies.

Just tried it, and that seems to be the case:

postgres=# create database test;
CREATE DATABASE
postgres=# \c test
You are now connected to database "test".
test=# create table t(f1 integer);
CREATE TABLE
test=# begin;
BEGIN
test=# insert into t values(1);
INSERT 0 1
test=# insert into t values(2);
INSERT 0 1
test=# \q
rod@teladesign:~$ psql -U postgres test
Password for user postgres:
Welcome to psql 8.3.5, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

test=# select * from t;
 f1
----
(0 rows)



Ray.

------------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod@xxxxxx
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux