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 3F0C19DC82F for ; Wed, 25 Jan 2006 10:54:43 -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 96422-01 for ; Wed, 25 Jan 2006 10:54:47 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.logix-tt.com (serval.logix-tt.com [213.239.221.42]) by postgresql.org (Postfix) with ESMTP id C0F6A9DC814 for ; Wed, 25 Jan 2006 10:54:40 -0400 (AST) Received: from kingfisher.intern.logix-tt.com (Md55a.m.pppool.de [89.49.213.90]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.logix-tt.com (Postfix) with ESMTP id BBB8224400F; Wed, 25 Jan 2006 15:54:45 +0100 (CET) Received: from [127.0.0.1] (localhost [127.0.0.1]) by kingfisher.intern.logix-tt.com (Postfix) with ESMTP id 966D7181C1BB6; Wed, 25 Jan 2006 15:54:42 +0100 (CET) Message-ID: <43D79132.9050900@logix-tt.com> Date: Wed, 25 Jan 2006 15:54:42 +0100 From: Markus Schaber Organization: Logical Tracking and Tracing International AG, Switzerland User-Agent: Debian Thunderbird 1.0.7 (X11/20051017) X-Accept-Language: en-us, en MIME-Version: 1.0 To: mario.splivalo@mobart.hr Cc: pgsql-sql@postgresql.org Subject: Re: Changing the transaction isolation level within the stored References: <1138198348.8828.32.camel@localhost.localdomain> In-Reply-To: <1138198348.8828.32.camel@localhost.localdomain> X-Enigmail-Version: 0.93.0.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.13 required=5 tests=[AWL=0.130] X-Spam-Score: 0.13 X-Spam-Level: X-Archive-Number: 200601/163 X-Sequence-Number: 23952 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