From: | Mario Splivalo <mario(dot)splivalo(at)mobart(dot)hr> |
---|---|
To: | Markus Schaber <schabi(at)logix-tt(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Changing the transaction isolation level within the |
Date: | 2006-01-26 07:11:03 |
Message-ID: | 1138259463.16164.4.camel@localhost.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
On Wed, 2006-01-25 at 15:54 +0100, Markus Schaber wrote:
> 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.
Is above true for the newly introduced stored procedures? (Above, when
mentioning 'stored procedures' I was actualy reffering to 'functions').
> > 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.
I have some ideas, I just needed confirmation it can't be done this way.
Thank you! :)
> 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.
Yes, a thread will need to start a transaction, I'm just affraid that
create_message could lead me to deadlocks.
Thank you for your responses.
Mario
From | Date | Subject | |
---|---|---|---|
Next Message | Markus Schaber | 2006-01-26 08:41:37 | Re: Changing the transaction isolation level within the |
Previous Message | Mario Splivalo | 2006-01-26 07:08:30 | Re: Changing the transaction isolation level within the |