pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Markus Schaber <schabi@logix-tt.com>
To: mario.splivalo@mobart.hr
Cc: pgsql-sql@postgresql.org
Subject: Re: Changing the transaction isolation level within the stored
Date: Wed, 25 Jan 2006 15:54:42 +0100
Message-ID: <43D79132.9050900@logix-tt.com> (raw)
In-Reply-To: <1138198348.8828.32.camel@localhost.localdomain>
References: <1138198348.8828.32.camel@localhost.localdomain>

Hi, Mario,

Mario Splivalo wrote:
> Is it possible to change the transaction level within the procedure?

No, currently not, the PostgreSQL "stored procedures" really are "stored
functions" that are called inside a query, and thus cannot contain inner
transactions.

> I'm using Postgres 8.1.2 default isolation level. But, I would like one
> stored procedure to execute as in serializable isolation level. I have
> created my stored procedure like this:
[...]
> One thread (thread A) does this:
> 
> 1. java got the message via http (whatever)
> 2. java does: begin;
> 3. java does: select * from create_message(...)
> 4. java does some checking
> 5. java does: select * from set_message_status(...)
> 6. java does some more checing
> 7. java does commit; (under rare circumstances java does rollback).

So you even want to change the transaction serialization level within a
running transaction? I'm sorry, this will not work, and I cannot think
of a sane way to make it work.

It is locically not possible to raise the isolation level when the
transaction was started with a lower level and thus may already have
irreversibly violated the constraits that the higher level wants to
guarantee.

HTH,
Markus
-- 
Markus Schaber | Logical Tracking&Tracing International AG
Dipl. Inf.     | Software Development GIS

Fight against software patents in EU! www.ffii.org www.nosoftwarepatents.org



view thread (13+ messages)  latest in thread

Message-ID: <43D79132.9050900@logix-tt.com>
Permalink:  ../43D79132.9050900@logix-tt.com/
Also on:    postgresql.org/message-id/43D79132.9050900@logix-tt.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: schabi@logix-tt.com, mario.splivalo@mobart.hr
  Subject: Re: Changing the transaction isolation level within the stored
  In-Reply-To: <43D79132.9050900@logix-tt.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox