Received: from gauss.deltav.hu (deltav.hu [213.163.0.2]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id f0JAM8094668 for ; Fri, 19 Jan 2001 05:22:08 -0500 (EST) (envelope-from ltibor@mail.tiszanet.hu) Received: from tir (eko-gw.ekopark.hu [213.163.10.100]) by gauss.deltav.hu (Netscape Messaging Server 3.6) with SMTP id AAA2548; Fri, 19 Jan 2001 11:25:23 +0100 From: Tibor Laszlo To: pgsql-interfaces@postgresql.org Subject: Re: pl/pgSQL & transaction Date: Fri, 19 Jan 2001 11:24:18 +0100 X-Mailer: KMail [version 1.0.28] Content-Type: text/plain References: <9478lh$1m2r$2@news.tht.net> In-Reply-To: <9478lh$1m2r$2@news.tht.net> Cc: "Zolof" MIME-Version: 1.0 Message-Id: <01011911292000.01181@tir> Content-Transfer-Encoding: 8bit X-Archive-Number: 200101/213 X-Sequence-Number: 831 > 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@mail.tiszanet.hu