PLPGSQL how to get transaction isolation level info - Mailing list pgsql-general

From Janning Vygen
Subject PLPGSQL how to get transaction isolation level info
Date
Msg-id 200507151732.47910.vygen@gmx.de
Whole thread Raw
Responses Re: PLPGSQL how to get transaction isolation level info
List pgsql-general
i have a function which calculates some aggregates (like a materialized view).
As my aggregation is made with a temp table and 5 SQL Queries, i need a
consistent view of the database. Therefor i need transaction isolation level
SERIALIZABLE, right? Otherwise the second query inside of the function could
read data which differs from the first query (Nonrepeatable Read or Phantom
Read)

ok. so far so good. But know i would like my function to abort if it is not
running inside ransaction isolation level SERIALIZABLE.

How can a function determine in which isolation level it runs?

I looked at the SHOW statement but didn't find anything. i dont wnat to know
the default_transaction_isolation but the current one used.

The reason is mainly for preventing some mistakes inside the caller app. Of
course the app should know what it does and wrap the function call inside a
serializable transaction, but to be sure that my materialized view is
consistent with the rest of the data i would like to enforce it.

Is it possible to get info about the current transaction isolation level?

kind regards,
janning

pgsql-general by date:

Previous
From: "Andrus"
Date:
Subject: Re: How to create unique constraint on NULL columns
Next
From: Hannes Dorbath
Date:
Subject: Re: Looking for a good ERD Tool