PLPGSQL how to get transaction isolation level info

From: Janning Vygen <vygen(at)gmx(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: PLPGSQL how to get transaction isolation level info
Date: 2005-07-15 15:32:47
Message-ID: 200507151732.47910.vygen@gmx.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2005-07-15 15:39:36 Re: How to create unique constraint on NULL columns
Previous Message Andrus 2005-07-15 15:26:43 Re: How to create unique constraint on NULL columns