Re: pl/pgSQL & transaction

From: Tibor Laszlo <ltibor(at)mail(dot)tiszanet(dot)hu>
To: pgsql-interfaces(at)postgresql(dot)org
Cc: "Zolof" <zolof(at)club-internet(dot)fr>
Subject: Re: pl/pgSQL & transaction
Date: 2001-01-19 10:24:18
Message-ID: 01011911292000.01181@tir
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs pgsql-general pgsql-interfaces pgsql-sql

> 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 ????

Is it possible to use transactions in PL/pgSQL functions? AFAIK these functions
always(?) in a transaction (eg as triggers or as stored pprocs) and PostgreSQL
doesn't support nested transactions.

--
Tibor Laszlo
ltibor(at)mail(dot)tiszanet(dot)hu

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Cedar Cox 2001-01-19 11:41:20 Re: [INTERFACES] pl/pgSQL & transaction
Previous Message Bruce Momjian 2001-01-19 04:57:07 Re: child table doesn't inherit PRIMARY KEY?

Browse pgsql-general by date

  From Date Subject
Next Message Matthew Taylor 2001-01-19 10:29:41 data dictionary
Previous Message Bjorn 2001-01-19 10:19:10 PostgreSQL ODBC question.

Browse pgsql-interfaces by date

  From Date Subject
Next Message Cedar Cox 2001-01-19 11:41:20 Re: [INTERFACES] pl/pgSQL & transaction
Previous Message Peter T Mount 2001-01-19 08:55:53 Re: [PATCHES] Re: Fixes and enhancements to JDBC driver (take 2)

Browse pgsql-sql by date

  From Date Subject
Next Message Nikolaj Lundsgaard 2001-01-19 10:55:31 Indices
Previous Message Sharmad Naik 2001-01-19 09:21:55 primary key and indexing