commit in plpgsql function?
commit in plpgsql function?
От:
Dennis Sacks <dennis@illusions.com>
Дата:
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
Re: commit in plpgsql function?
От:
"Gregory S. Williamson" <gsw@globexplorer.com>
Дата:
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@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