Re: Bit by "commands ignored until end of transaction block" again

Поиск
Список
Период
Сортировка
Искать
От
Alvaro Herrera
Тема
Re: Bit by "commands ignored until end of transaction block" again
Дата
Msg-id
20090724165431.GB15591@alvh.no-ip.org
Ответ на
Список
Дерево обсуждения
Bit by "commands ignored until end of transaction block" again Glenn Maynard <glenn@zewt.org>
Re: Bit by "commands ignored until end of transaction block" again Richard Huxton <dev@archonet.com>
Re: Bit by "commands ignored until end of transaction block" again Glenn Maynard <glenn@zewt.org>
Re: Bit by "commands ignored until end of transaction block" again Joshua Tolley <eggyknap@gmail.com>
Re: Bit by "commands ignored until end of transaction block" again Alvaro Herrera <alvherre@commandprompt.com>
Re: Bit by "commands ignored until end of transaction block" again Joshua Tolley <eggyknap@gmail.com>
Re: Bit by "commands ignored until end of transaction block" again Chris <dmagick@gmail.com>
Re: Bit by "commands ignored until end of transaction block" again Craig Ringer <craig@postnewspapers.com.au>
Re: Bit by "commands ignored until end of transaction block" again Thomas Kellerer <spam_eater@gmx.net>
Re: Bit by "commands ignored until end of transaction block" again Stephen Frost <sfrost@snowman.net>
Re: Bit by "commands ignored until end of transaction block" again Richard Huxton <dev@archonet.com>
Re: Bit by "commands ignored until end of transaction block" again Glenn Maynard <glenn@zewt.org>
Re: Bit by "commands ignored until end of transaction block" again Craig Ringer <craig@postnewspapers.com.au>
Re: Bit by "commands ignored until end of transaction block" again Adrian Klaver <aklaver@comcast.net>
Re: Bit by "commands ignored until end of transaction block" again Richard Huxton <dev@archonet.com>
Re: Bit by "commands ignored until end of transaction block" again Glenn Maynard <glenn@zewt.org>
Joshua Tolley escribió:

> Have you tried this? I expect if you give it a shot, you'll find you don't
> actually have this problem. Really, everything is always in a transaction. If
> you haven't explicitly opened one, PostgreSQL opens one for you before each
> statement, and issues a COMMIT afterwards (or a ROLLBACK, if your statement
> ran into an error). Statements within functions are always executed within the
> same transaction, so you can issue SAVEPOINT commands anywhere in PL/pgSQL
> functions without problems, because you're always in a transaction.

No, actually you can't call SAVEPOINT inside a PL/pgSQL function (or any
SPI user for that matter -- have you tried savepoints in LOLCODE?)
Inside PL/pgSQL the only way to use savepoints is with EXCEPTION blocks.

You are correct that you're always in a transaction, but in this context
not all transactions are equal :-(

(The problem, as we found out, is that the function must always have
control at the same level of transaction nestedness in SPI; you can't
just let the user define and release savepoints arbitrarily.)

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

В списке pgsql-sql по дате отправления
От: Craig Ringer
Дата:
От: Joshua Tolley
Дата:
FAQ