Re: how to use savepoint and rollback in function

From: dhaval jaiswal <dhavallj(at)hotmail(dot)com>
To: <tpnehete(at)gmail(dot)com>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: how to use savepoint and rollback in function
Date: 2011-03-16 08:14:40
Message-ID: SNT117-W299F97B3F90E1D117A33D7DFCE0@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general




create table mock (id int);
begin;
truncate table mock;
insert into mock values (1),(2);
savepoint A;
insert into mock values (3),(4);
savepoint B;
rollback to savepoint A;
end;

Following link may help you.
http://www.postgresql.org/docs/current/static/sql-rollback-to.html

Date: Wed, 16 Mar 2011 10:55:23 +0530
Subject: [GENERAL] how to use savepoint and rollback in function
From: tpnehete(at)gmail(dot)com
To: pgsql-general(at)postgresql(dot)org

Hi All,
In Postgresql we can use savepoint and rollback to savepoint in transaction.
But we cannot use savepoint in function.
Currently I am doing migration from Informix to Postgresql 8.4.
In Informix they used Savepoint.
Please advice how to use Savepoint and rollback to savepoint in function.
I know Postgresql has autocommit. But I want to rollback to a particular savepoint.

Thanks & Regards,
Tushar

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jo 2011-03-16 09:16:38 Re: Postgres 8.3 vs. 8.4 - Query plans and performance
Previous Message Alban Hertroys 2011-03-16 07:46:37 Re: how to use savepoint and rollback in function