Re: open transaction?

Поиск
Список
Период
Сортировка
От Raymond O'Donnell
Тема Re: open transaction?
Дата
Msg-id 4958BD2C.10906@iol.ie
обсуждение исходный текст
Ответ на Re: open transaction?  (Raymond O'Donnell <rod@iol.ie>)
Ответы Re: open transaction?
Список pgsql-general
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@iol.ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------

В списке pgsql-general по дате отправления:

Предыдущее
От: Raymond O'Donnell
Дата:
Сообщение: Re: open transaction?
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: encoding of PostgreSQL messages