By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,609 Members | 1,161 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,609 IT Pros & Developers. It's quick & easy.

Are functions automatically transactioned?

P: n/a
I need to perform a couple of queries in a function and I need them to be in
the same transaction. I understand I can't start and stop transactions from
inside the functions. But are the contents of a function placed in a
transaction automatically by the server, or do I have to "manually" control
the transaction around the call to the function?

--
Ciprian Popovici

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 23 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
Ciprian, I just saw this in the online docs at
http://www.postgresql.org/docs/7.4/i...structure.html

It is important not to confuse the use of BEGIN /END for grouping
statements in PL/pgSQL with the database commands for transaction
control. PL/pgSQL 's BEGIN /END are only for grouping; they do not
start or end a transaction. 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.

HTH

Kevin Lohka
On Wednesday, April 7, 2004, at 03:43 PM, Ciprian Popovici wrote:
But are the contents of a function placed in a
transaction automatically by the server, or do I have to "manually"
control
the transaction around the call to the function?

--
Ciprian Popovici


Nov 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.