X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id CB17C9DC844 for ; Thu, 26 Jan 2006 03:12:37 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 03886-05 for ; Thu, 26 Jan 2006 03:12:34 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 70F929DC820 for ; Thu, 26 Jan 2006 03:12:32 -0400 (AST) Received: from ls405.htnet.hr (ls405.htnet.hr [195.29.150.97]) by svr4.postgresql.org (Postfix) with ESMTP id 684485AF0BB for ; Thu, 26 Jan 2006 07:12:33 +0000 (GMT) Received: from ls401.t-com.hr (ls401.t-com.hr [195.29.150.236]) by ls405.htnet.hr (0.0.0/8.12.10) with ESMTP id k0Q7CQSn021006; Thu, 26 Jan 2006 08:12:30 +0100 Received: from ls401.t-com.hr (localhost.localdomain [127.0.0.1]) by ls401.t-com.hr (Qmlai) with ESMTP id 187FF70006; Thu, 26 Jan 2006 08:12:26 +0100 (CET) X-Envelope-Sender: mario.splivalo@mobart.hr X-Envelope-Sender: mario.splivalo@mobart.hr Received: from 83-131-72-216.adsl.net.t-com.hr (83-131-72-216.adsl.net.t-com.hr [83.131.72.216]) by ls401.t-com.hr (Qmlai) with ESMTP id C3831A8008; Thu, 26 Jan 2006 08:12:21 +0100 (CET) Subject: Re: Changing the transaction isolation level within the From: Mario Splivalo Reply-To: mario.splivalo@mobart.hr To: Markus Schaber Cc: pgsql-sql@postgresql.org In-Reply-To: <43D79132.9050900@logix-tt.com> References: <1138198348.8828.32.camel@localhost.localdomain> <43D79132.9050900@logix-tt.com> Content-Type: text/plain Organization: Mob-Art Date: Thu, 26 Jan 2006 08:11:03 +0100 Message-Id: <1138259463.16164.4.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.096 required=5 tests=[AWL=0.096] X-Spam-Score: 0.096 X-Spam-Level: X-Archive-Number: 200601/173 X-Sequence-Number: 23962 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