Transactions and functions

From: "<Miguel Sofer" <mig(at)utdt(dot)edu>
To: pgsql-sql(at)postgresql(dot)org
Subject: Transactions and functions
Date: 1999-12-10 13:35:48
Message-ID: 199912101335.KAA07281@ant.utdt
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Eric BARROCA 1999-12-10 15:46:42 INSERT and SELECT
Previous Message Czarny Marcin 1999-12-10 13:27:39 Deleting large objects.