X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 3A4CE3A1D8F for ; Wed, 10 Nov 2004 08:45:29 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 55547-02 for ; Wed, 10 Nov 2004 08:45:21 +0000 (GMT) Received: from web13902.mail.yahoo.com (web13902.mail.yahoo.com [216.136.175.28]) by svr1.postgresql.org (Postfix) with SMTP id 2685C3A3C0B for ; Wed, 10 Nov 2004 08:45:21 +0000 (GMT) Received: (qmail 10683 invoked by uid 60001); 10 Nov 2004 08:45:19 -0000 Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; b=k+sPnDT/O66aPRM5gTSCayViUQluC+WWO6Ar51socF7Hxz0Upbnacg/BDr0hQJ2433I8hoA9F///UWi+S5QPgCaltgGSXS7fPXauzPFf7BmABP5VcnEy/RPWiHwHeVDn4TyH7tcMeztmsWQa0hugdmEoMcwhwo3niXuXhjHVfGY= ; Message-ID: <20041110084519.10681.qmail@web13902.mail.yahoo.com> Received: from [80.67.100.162] by web13902.mail.yahoo.com via HTTP; Wed, 10 Nov 2004 00:45:19 PST Date: Wed, 10 Nov 2004 00:45:19 -0800 (PST) From: "Riccardo G. Facchini" Reply-To: abief_ag_-postgresql@yahoo.com Subject: Re: A transaction in transaction? Possible? To: pgsql-sql@postgresql.org Cc: Theodore Petrosky , Andrei Bintintan , Michael Fuhr , sad In-Reply-To: <20041110062510.GA54426@winnie.fuhr.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200411/99 X-Sequence-Number: 19418 Sorry, but I understand that your example is not really about nested transactions, but about sequential transactions. so, the primary question remains: how to commit/rollback them ? --- Michael Fuhr <__> wrote: > On Wed, Nov 10, 2004 at 09:23:02AM +0300, sad wrote: > > On Tuesday 09 November 2004 18:24, Theodore Petrosky wrote: > > > I thought nested transactions are available in the new > > > release (8) coming up. > > > > how to commit/rollback them ? > > CREATE TABLE person (id SERIAL PRIMARY KEY, name TEXT NOT NULL); > > BEGIN; > INSERT INTO person (name) VALUES ('Tom'); > SAVEPOINT foo; > INSERT INTO person (name) VALUES ('Dick'); > ROLLBACK TO foo; > INSERT INTO person (name) VALUES ('Harry'); > COMMIT; > > SELECT * FROM person; > id | name > ----+------- > 1 | Tom > 3 | Harry > (2 rows) > > -- > Michael Fuhr > http://www.fuhr.org/~mfuhr/ > > ---------------------------(end of > broadcast)--------------------------- > TIP 8: explain analyze is your friend >