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

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 (view raw or flat)
Thread:
Lists: pgsql-docspgsql-generalpgsql-interfacespgsql-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

pgsql-docs by date

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

pgsql-general by date

Next:From: Matthew TaylorDate: 2001-01-19 10:29:41
Subject: data dictionary
Previous:From: BjornDate: 2001-01-19 10:19:10
Subject: PostgreSQL ODBC question.

pgsql-interfaces by date

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

pgsql-sql by date

Next:From: Nikolaj LundsgaardDate: 2001-01-19 10:55:31
Subject: Indices
Previous:From: Sharmad NaikDate: 2001-01-19 09:21:55
Subject: primary key and indexing

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