Re: commit in plpgsql function? - Mailing list pgsql-sql

From Gregory S. Williamson
Subject Re: commit in plpgsql function?
Date
Msg-id 71E37EF6B7DCC1499CEA0316A256832801D4BC55@loki.wc.globexplorer.net
Whole thread Raw
In response to commit in plpgsql function?  (Dennis Sacks <dennis@illusions.com>)
List pgsql-sql
I don't think you can do transactions within a procedure in postgres, at least in version 7.x, which I am most familiar
with.Page 579 on the postgres 7.4 manual says: 
"Functions and trigger procedures are always executed within a transaction established by an outer query --- they
cannotstart or commit transactions, since PostgreSQL does not have nested transactions." 

Greg Williamson
DBA
GlobeXplorer LLC

-----Original Message-----
From:    Dennis Sacks [mailto:dennis@illusions.com]
Sent:    Tue 12/21/2004 9:34 AM
To:    pgsql-sql@postgresql.org
Cc:
Subject:    [SQL] commit in plpgsql function?
Hi,

I am converting oracle stored procedures to plpgsql. There are several
of the oracle procedures where a parameter vCommit is passed into the
procedure and:

if vCommit = 1  then      commit;      do_something_commit(vdate);  else      do_something(vdate);  end if;

does this make sense in plpgsql? Does it make sense to do a commit in
plpgsql?

Thanks,

Dennis

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend





pgsql-sql by date:

Previous
From: Dennis Sacks
Date:
Subject: commit in plpgsql function?
Next
From: "thomas.silvi"
Date:
Subject: Re: I'm stumped