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 ????
On Thu, 18 Jan 2001, 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 ???? You didn't read the documentation. "It is important not to misunderstand the meaning of BEGIN/END for grouping statements in PL/pgSQL and the database commands for transaction control. Functions and trigger procedures cannot start or commit transactions and Postgres does not have nested transactions. "
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера