Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 7A631633E80 for ; Thu, 23 Jul 2009 04:32:38 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 42866-07 for ; Thu, 23 Jul 2009 04:32:27 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by mail.postgresql.org (Postfix) with ESMTP id E6CB5633349 for ; Thu, 23 Jul 2009 04:32:27 -0300 (ADT) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1MTsmt-0000zB-Vr for pgsql-sql@postgresql.org; Thu, 23 Jul 2009 07:32:24 +0000 Received: from 217.110.94.67 ([217.110.94.67]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 23 Jul 2009 07:32:23 +0000 Received: from spam_eater by 217.110.94.67 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 23 Jul 2009 07:32:23 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-sql@postgresql.org From: Thomas Kellerer Subject: Re: Bit by "commands ignored until end of transaction block" again Date: Thu, 23 Jul 2009 09:32:17 +0200 Lines: 46 Message-ID: References: <4A67F5B6.4080409@archonet.com> <20090723064656.GO25450@eddie> <4A680C03.6040701@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 217.110.94.67 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.22) Gecko/20090605 Thunderbird/2.0.0.22 Mnenhy/0.7.6.666 In-Reply-To: <4A680C03.6040701@gmail.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=2.599 tagged_above=-10 required=5 tests=RCVD_NUMERIC_HELO=2.599 X-Spam-Level: ** X-Archive-Number: 200907/113 X-Sequence-Number: 32854 Chris, 23.07.2009 09:06: > psql -d dbname > .. > # select now(); > now > ------------------------------- > 2009-07-23 17:04:21.406424+10 > (1 row) > > Time: 2.434 ms > (csmith@[local]:5432) 17:04:21 [test] > # savepoint xyz; > ERROR: SAVEPOINT can only be used in transaction blocks > (csmith@[local]:5432) 17:04:25 [test] > > You haven't explicitly started a transaction, therefore savepoints won't > work. > > Django (it seems) just issues queries with no knowledge of (and no way > to support) them. The above situation only arises if you run in autocommit mode which is the default for psql (which I have *never* understood). If you do a "\set AUTOCOMMIT off", then you can set a savepoint without using BEGIN. I have this in my psqlrc.conf and your example looks like this on my computer: c:\Temp>psql training thomas psql (8.4.0) Type "help" for help. training=> select now(); now ---------------------------- 2009-07-23 09:30:55.791+02 (1 row) training=> savepoint abc; SAVEPOINT training=> release abc; RELEASE training=> I don't believe any serious ORM would run in autocommit mode, so that shouldn't be a problem. Thomas