pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Mack <mack@ips.cs.tu-bs.de>
To: pgsql-sql@postgresql.org
Subject: Re: transactions within stored procedures
Date: Fri, 14 Jul 2000 18:19:17 +0200 (MET DST)
Message-ID: <200007141619.SAA27684@infbsdb1.idb.cs.tu-bs.de> (raw)

>
>By trial and error I established that a SP wraps everything it does in
>one transaction, including anything from stored procedures it calls.
>
>So here is my question:  Is there any way for me to control when
>transactions are committed or rolled back within stored procedures?  Is

When you invoke a procedure, this invocation is part of a transaction.
You cannot nest transactions so far, as you intend, when you want to
commit or rollback inside of a procedure.

So, when you want your procedure to fail, you would raise an exception,
otherwise, you won't. The invoking program has to react on errors, as it
should do in other situations as well.

For example, select * from xyz fails with an error, when table xyz does
not exist. If you have this statement inside of a transaction, you
would normally react on the error (commit / rollback).


Thomas Mack
TU Braunschweig, Abt. Informationssysteme



view thread (2+ messages)

Message-ID: <200007141619.SAA27684@infbsdb1.idb.cs.tu-bs.de>
Permalink:  ../200007141619.SAA27684@infbsdb1.idb.cs.tu-bs.de/
Also on:    postgresql.org/message-id/200007141619.SAA27684@infbsdb1.idb.cs.tu-bs.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: mack@ips.cs.tu-bs.de
  Subject: Re: transactions within stored procedures
  In-Reply-To: <200007141619.SAA27684@infbsdb1.idb.cs.tu-bs.de>
  References: <200007141619.SAA27684@infbsdb1.idb.cs.tu-bs.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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