Re: commit in plpgsql function?

From: "Gregory S(dot) Williamson" <gsw(at)globexplorer(dot)com>
To: "Dennis Sacks" <dennis(at)illusions(dot)com>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: commit in plpgsql function?
Date: 2004-12-21 21:08:20
Message-ID: 71E37EF6B7DCC1499CEA0316A256832801D4BC55@loki.wc.globexplorer.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 cannot start or commit transactions, since PostgreSQL does not have nested transactions."

Greg Williamson
DBA
GlobeXplorer LLC

-----Original Message-----
From: Dennis Sacks [mailto:dennis(at)illusions(dot)com]
Sent: Tue 12/21/2004 9:34 AM
To: pgsql-sql(at)postgresql(dot)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

Browse pgsql-sql by date

  From Date Subject
Next Message thomas.silvi 2004-12-21 22:39:00 Re: I'm stumped
Previous Message Dennis Sacks 2004-12-21 17:34:02 commit in plpgsql function?