Skip site navigation (1) Skip section navigation (2)

Re: open transaction?

From: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
To: rod(at)iol(dot)ie
Cc: "blackwater dev" <blackwaterdev(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: open transaction?
Date: 2008-12-29 12:22:58
Message-ID: 162867790812290422p7eed90e1o2abc3854e303f2bd@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-general
Hello

maybe you have autocommit on

try

[pavel(at)localhost ~]$ psql postgres
psql (8.4devel)
Type "help" for help.

postgres=# \set
AUTOCOMMIT = 'on'
PROMPT1 = '%/%R%# '
PROMPT2 = '%/%R%# '

regards
Pavel Stehule

2008/12/29 Raymond O'Donnell <rod(at)iol(dot)ie>:
> 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(at)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(at)iol(dot)ie
> Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
> ------------------------------------------------------------------
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>

In response to

pgsql-general by date

Next:From: Reg Me PleaseDate: 2008-12-29 14:08:54
Subject: [PGSQL 8.3.5] Use of a partial indexes
Previous:From: Alvaro HerreraDate: 2008-12-29 12:07:14
Subject: Re: encoding of PostgreSQL messages

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group