Thread: Setting the transaction isolation level for a stored procedure

Setting the transaction isolation level for a stored procedure

From
Keith Wong
Date:
Sorry, I forgot to put a subject title in my last email. So here it is again.

Hi ppl,

Just wondering if anyone knows if its possible to set the transaction 
isolation
level from inside a stored procedure in plpgsql. Or do I need to run the 
'set transaction
isolation level' command before I called the stored procedure? I'm not even 
sure that
would work, I assume plpgsql uses the current transaction isolation level?
Any help would be much appreciated :)

Cheers, Keith. 



Transaction isolation level for plpgsql

From
Keith Wong
Date:
Hi all,

Does anybody know the transaction isolation level default when a plpgsql 
stored procedure is called?
Is it possible to set it? Or is this controlled by SPI?

Cheers,
Keith.



Re: Transaction isolation level for plpgsql

From
"Poul L. Christiansen"
Date:
Use the command "\h set" and you'll see the parameters.

test=# \h set
Command:     SET
Description: Set run-time parameters for session
Syntax:
SET variable { TO | = } { value | 'value' | DEFAULT }
SET CONSTRAINTS {ALL | constraintlist} mode
SET TIME ZONE { 'timezone' | LOCAL | DEFAULT }
SET TRANSACTION ISOLATION LEVEL { READ COMMITTED | SERIALIZABLE }

test=# show transaction isolation level;
NOTICE:  TRANSACTION ISOLATION LEVEL is READ COMMITTED
SHOW VARIABLE
test=#

HTH,
Poul L. Christiansen


Keith Wong wrote:
> 
> Hi all,
> 
> Does anybody know the transaction isolation level default when a plpgsql
> stored procedure is called?
> Is it possible to set it? Or is this controlled by SPI?
> 
> Cheers,
> Keith.


Re: Transaction isolation level for plpgsql

From
Peter Eisentraut
Date:
Keith Wong writes:

> Does anybody know the transaction isolation level default when a plpgsql 
> stored procedure is called?
> Is it possible to set it? Or is this controlled by SPI?

It's whatever the transaction that called the function was set to.

-- 
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/