Transactions and functions - Mailing list pgsql-sql

From
Subject Transactions and functions
Date
Msg-id 199912101335.KAA07281@ant.utdt
Whole thread Raw
Responses having with sub select?
List pgsql-sql
I have read (in the manual? Can't remember ...) that you cannot BEGIN
a transaction in the body of a CREATE FUNCTION (at least for pltcl
functions - I seem to remember it has something to do with the SPI
interface, so that I assume it is true for any other user defined
function).

As I want to do some work within such a function, and I do need the
transaction to be protected from concurrent access by other users, I
am wondering how to do this.

Specifically, the question is: does a single SQL statement of the form   SELECT myFunction()
constitute a transaction, even if it involves multiple SQL statements
and SPI calls within the function definition? 

Assuming the answer to the previous question is 'yes': how can I
insure that the transaction isolation level is set to SERIALIZABLE? Do
I have to do it from the calling application, or is there a way to let
the function itself set the required isolation level?

Thanks

Miguel Sofer


pgsql-sql by date:

Previous
From: Czarny Marcin
Date:
Subject: Deleting large objects.
Next
From: Eric BARROCA
Date:
Subject: INSERT and SELECT