Re: Pl/pgSQL & TRANSACTION

Поиск
Список
Период
Сортировка
От Robert B. Easter
Тема Re: Pl/pgSQL & TRANSACTION
Дата
Msg-id 0101182051410M.02219@comptechnews
обсуждение исходный текст
Ответ на Pl/pgSQL & TRANSACTION  ("Zolof" <zolof@club-internet.fr>)
Список pgsql-docs
You'll have to begin the transaction before the function is run (implicit
within a query if not in a xact).  End the transaction after the function
returns.  If the function does a RAISE EXCEPTION ''I don't like that'', then
the transaction is aborted during the function.  Again, within a query (which
triggers your function), a transaction is begun implicity if a transaction is
not begun explicity beforehand with BEGIN.


On Thursday 18 January 2001 12:16, Zolof wrote:
> This code doesn't work. I use Begin Work to start a transaction but BEGIN
> is a PL/pgSQL command so I have a parse error when executing it.
>
> CREATE FUNCTION a () RETURNS int4 AS '
> BEGIN
>    BEGIN WORK;
>    COMMIT WORK;
>     return 1;
>     END;
> ' LANGUAGE 'plpgsql';
>
> What's wrong ????

--
-------- Robert B. Easter  reaster@comptechnews.com ---------
-- CompTechNews Message Board http://www.comptechnews.com/ --
-- CompTechServ Tech Services http://www.comptechserv.com/ --
---------- http://www.comptechnews.com/~reaster/ ------------

В списке pgsql-docs по дате отправления:

Предыдущее
От: "Zolof"
Дата:
Сообщение: Pl/pgSQL & TRANSACTION
Следующее
От: "Orland A. Cajilig"
Дата:
Сообщение: More Details