pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedtransaction in function
4+ messages / 4 participants
[nested] [flat]
* transaction in function
@ 2006-12-05 15:25 Marian POPESCU <softexpert@libertysurf.fr>
2006-12-05 16:23 ` Re: transaction in function A. Kretschmer <andreas.kretschmer@schollglas.com>
2006-12-05 16:57 ` Re: transaction in function Tom Lane <tgl@sss.pgh.pa.us>
2006-12-05 20:32 ` Re: transaction in function Din Adrian <adrian.din@easynet.ro>
0 siblings, 3 replies; 4+ messages in thread
From: Marian POPESCU @ 2006-12-05 15:25 UTC (permalink / raw)
To: pgsql-sql
Hi,
I want to write a function that updates several tables; if there is an
exception while updating, it should rollback the transaction and raise an
error.
How can this be done in pgPLSQL in PostgreSQL 8.1 ?
Thank you for helping me out on this one !
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: transaction in function
2006-12-05 15:25 transaction in function Marian POPESCU <softexpert@libertysurf.fr>
@ 2006-12-05 16:23 ` A. Kretschmer <andreas.kretschmer@schollglas.com>
2 siblings, 0 replies; 4+ messages in thread
From: A. Kretschmer @ 2006-12-05 16:23 UTC (permalink / raw)
To: pgsql-sql
am Tue, dem 05.12.2006, um 16:25:31 +0100 mailte Marian POPESCU folgendes:
> Hi,
>
> I want to write a function that updates several tables; if there is an
> exception while updating, it should rollback the transaction and raise an
> error.
>
> How can this be done in pgPLSQL in PostgreSQL 8.1 ?
A function runs within a transaction. You can trapp errors within a
function, read this:
http://www.postgresql.org/docs/8.1/interactive/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPIN...
Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47215, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: transaction in function
2006-12-05 15:25 transaction in function Marian POPESCU <softexpert@libertysurf.fr>
@ 2006-12-05 16:57 ` Tom Lane <tgl@sss.pgh.pa.us>
2 siblings, 0 replies; 4+ messages in thread
From: Tom Lane @ 2006-12-05 16:57 UTC (permalink / raw)
To: Marian POPESCU <softexpert@libertysurf.fr>; +Cc: pgsql-sql
Marian POPESCU <softexpert@libertysurf.fr> writes:
> I want to write a function that updates several tables; if there is an
> exception while updating, it should rollback the transaction and raise an
> error.
> How can this be done in pgPLSQL in PostgreSQL 8.1 ?
You just do it. You would have to work at it to *not* have that behavior.
regards, tom lane
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: transaction in function
2006-12-05 15:25 transaction in function Marian POPESCU <softexpert@libertysurf.fr>
@ 2006-12-05 20:32 ` Din Adrian <adrian.din@easynet.ro>
2 siblings, 0 replies; 4+ messages in thread
From: Din Adrian @ 2006-12-05 20:32 UTC (permalink / raw)
To: Marian POPESCU <softexpert@libertysurf.fr>; pgsql-sql
Any function runs into a single transaction so you don't need to worry
about rolling back on exceptions - this is the standard behavior. If there
is an exception while running any statement inside the function it's
rolls back automatically.
On Tue, 05 Dec 2006 17:25:31 +0200, Marian POPESCU
<softexpert@libertysurf.fr> wrote:
> Hi,
>
> I want to write a function that updates several tables; if there is an
> exception while updating, it should rollback the transaction and raise an
> error.
>
> How can this be done in pgPLSQL in PostgreSQL 8.1 ?
>
> Thank you for helping me out on this one !
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
> choose an index scan if your joining column's datatypes do not
> match
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2006-12-05 20:32 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-12-05 15:25 transaction in function Marian POPESCU <softexpert@libertysurf.fr>
2006-12-05 16:23 ` A. Kretschmer <andreas.kretschmer@schollglas.com>
2006-12-05 16:57 ` Tom Lane <tgl@sss.pgh.pa.us>
2006-12-05 20:32 ` Din Adrian <adrian.din@easynet.ro>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox