pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedcommit in plpgsql function?
2+ messages / 2 participants
[nested] [flat]
* commit in plpgsql function?
@ 2004-12-21 17:34 Dennis Sacks <dennis@illusions.com>
0 siblings, 0 replies; 2+ messages in thread
From: Dennis Sacks @ 2004-12-21 17:34 UTC (permalink / raw)
To: pgsql-sql
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
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: commit in plpgsql function?
@ 2004-12-21 21:08 Gregory S. Williamson <gsw@globexplorer.com>
0 siblings, 0 replies; 2+ messages in thread
From: Gregory S. Williamson @ 2004-12-21 21:08 UTC (permalink / raw)
To: Dennis Sacks <dennis@illusions.com>; 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@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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2004-12-21 21:08 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-12-21 17:34 commit in plpgsql function? Dennis Sacks <dennis@illusions.com>
2004-12-21 21:08 Re: commit in plpgsql function? Gregory S. Williamson <gsw@globexplorer.com>
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