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 

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Reply via email to