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
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs pgsql-general pgsql-interfaces pgsql-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

Browse pgsql-docs by date

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

Browse pgsql-general by date

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

Browse pgsql-interfaces by date

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

Browse pgsql-sql by date

  From Date Subject
Next Message Aleksey V. Kurinov 2001-01-19 12:23:31 SELECT FROM SELECT
Previous Message Nikolaj Lundsgaard 2001-01-19 10:55:31 Indices