Skip site navigation (1) Skip section navigation (2)

Re: [INTERFACES] pl/pgSQL & transaction

From: Cedar Cox <cedarc(at)visionforisrael(dot)com>
To: Zolof <zolof(at)club-internet(dot)fr>
Cc: pgsql-docs(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org, pgsql-interfaces(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Re: [INTERFACES] pl/pgSQL & transaction
Date: 2001-01-19 11:41:20
Message-ID: Pine.LNX.4.21.0101191339290.6940-100000@nanu.visionforisrael.com (view raw or flat)
Thread:
Lists: pgsql-docspgsql-generalpgsql-interfacespgsql-sql

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. "



In response to

pgsql-docs by date

Next:From: Stephan SzaboDate: 2001-01-19 17:37:02
Subject: Re: child table doesn't inherit PRIMARY KEY?
Previous:From: Tibor LaszloDate: 2001-01-19 10:24:18
Subject: Re: pl/pgSQL & transaction

pgsql-general by date

Next:From: Jan WieckDate: 2001-01-19 13:03:02
Subject: Re: Troubles with performances
Previous:From: Brett W. McCoyDate: 2001-01-19 11:38:26
Subject: Re: data dictionary

pgsql-interfaces by date

Next:From: Steve SullivanDate: 2001-01-19 14:35:10
Subject: JDBC gives pq_recvbuf: unexpected EOF on client connection
Previous:From: Tibor LaszloDate: 2001-01-19 10:24:18
Subject: Re: pl/pgSQL & transaction

pgsql-sql by date

Next:From: Aleksey V. KurinovDate: 2001-01-19 12:23:31
Subject: SELECT FROM SELECT
Previous:From: Nikolaj LundsgaardDate: 2001-01-19 10:55:31
Subject: Indices

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group