X-Original-To: pgsql-hackers-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 9E0AD528BC for ; Wed, 3 Aug 2005 12:32:39 -0300 (ADT) 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 89844-09 for ; Wed, 3 Aug 2005 15:32:29 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id C28DB528B0 for ; Wed, 3 Aug 2005 12:32:27 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j73FWOgg036766 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 3 Aug 2005 09:32:26 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j73FWN1P020558 for ; Wed, 3 Aug 2005 09:32:23 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j73FWNLw020557 for pgsql-hackers@postgresql.org; Wed, 3 Aug 2005 09:32:23 -0600 (MDT) (envelope-from mfuhr) Date: Wed, 3 Aug 2005 09:32:23 -0600 From: Michael Fuhr To: pgsql-hackers@postgresql.org Subject: ECPG ignores SAVEPOINT if first statement of a transaction Message-ID: <20050803153223.GA17861@winnie.fuhr.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.109 tagged_above=0 required=5 tests=AWL, UPPERCASE_25_50 X-Spam-Level: X-Archive-Number: 200508/68 X-Sequence-Number: 71263 ECPG ignores SAVEPOINT if it's the first statement of a transaction: % cat foo.pgc int main(void) { EXEC SQL WHENEVER SQLERROR SQLPRINT; EXEC SQL WHENEVER SQLWARNING SQLPRINT; EXEC SQL CONNECT TO test; EXEC SQL SAVEPOINT foo; EXEC SQL DROP TABLE nosuch_1; EXEC SQL ROLLBACK TO foo; EXEC SQL DROP TABLE nosuch_2; EXEC SQL COMMIT; EXEC SQL DISCONNECT; return 0; } % ./foo sql error 'table "nosuch_1" does not exist' in line 10. sql error 'current transaction is aborted, commands ignored until end of transa The SAVEPOINT code is generated but apparently ECPGtrans() doesn't execute it. A sniff of the connection doesn't show it, and the sniff shows the ROLLBACK TO failing with "no such savepoint." If I execute a command before the SAVEPOINT then I get the following, which is what I was expecting: % ./foo sql error 'table "nosuch_1" does not exist' in line 11. sql error 'table "nosuch_2" does not exist' in line 13. A sniff of this connection shows both the SAVEPOINT and ROLLBACK TO being executed and succeeding. -- Michael Fuhr http://www.fuhr.org/~mfuhr/