From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-sql@postgresql.org
Subject: Re: Bit by "commands ignored until end of transaction block" again
Date: Thu, 23 Jul 2009 09:32:17 +0200
Message-ID: <h493ls$fd$1@ger.gmane.org> (raw)
In-Reply-To: <4A680C03.6040701@gmail.com>
References: <bd36f99e0907222158k6b4b3a0al65766c0d9c4906cf@mail.gmail.com>
<4A67F5B6.4080409@archonet.com>
<bd36f99e0907222304x38cfa50bkeba19f7c9b2694@mail.gmail.com>
<20090723064656.GO25450@eddie>
<4A680C03.6040701@gmail.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: spam_eater@gmx.net
Subject: Re: Bit by "commands ignored until end of transaction block" again
In-Reply-To: <h493ls$fd$1@ger.gmane.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox