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 621629DC892 for ; Mon, 19 Dec 2005 09:46:39 -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 42507-03 for ; Mon, 19 Dec 2005 09:46:42 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from TWMAIL.ESNCC.COM (static-66-173-159-28.t1.cavtel.net [66.173.159.28]) by postgresql.org (Postfix) with ESMTP id DC9B49DC860 for ; Mon, 19 Dec 2005 09:46:36 -0400 (AST) Received: from spawar2i8uvlb9 ([150.125.117.63]) by TWMAIL.ESNCC.COM with Microsoft SMTPSVC(5.0.2195.6713); Mon, 19 Dec 2005 08:46:40 -0500 From: "Lane Van Ingen" To: "Achilleus Mantzios" Cc: Subject: Re: How to Force Transactions to Process Serially on A Table Date: Mon, 19 Dec 2005 08:46:39 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-7" Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) In-Reply-To: X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.181 Importance: Normal X-OriginalArrivalTime: 19 Dec 2005 13:46:40.0813 (UTC) FILETIME=[A3EDEDD0:01C604A2] X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.201 required=5 tests=[AWL=0.201] X-Spam-Score: 0.201 X-Spam-Level: X-Archive-Number: 200512/158 X-Sequence-Number: 23700 Thanks, that helped. Please answer 2 other related questions, if you would: (1) What must I do to 'Be prepared for serialization failures' (how to detect, how to handle)? Do you have a sample? (2) Also, I am assuming that the effect of all of this is to just force transactions to wait in line to be processed serially, and that it only lasts as long as the pl/pgsql transaction block or the next COMMIT. -----Original Message----- From: Achilleus Mantzios [mailto:achill@matrix.gatewaynet.com] Sent: Monday, December 19, 2005 9:25 AM To: Lane Van Ingen Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] How to Force Transactions to Process Serially on A Table O Lane Van Ingen έγραψε στις Dec 19, 2005 : > I am using PL/SQL functions on Windows 2003, version 8.0.1. > > I have not used explicit PostgreSQL LOCKing before, but I need some advice > on how properly to use some explicit locking. I think that duplicate key > violations I am now getting are the result. > > I want to force transactions being used to update a table to be processed on > a first-come, first-served basis. I want my Pl/sql function to execute to > completion on each transaction before another starts. > > Need some advice on how to do this. From what I can read in the docs, it > looks like I need to solve the problem by using the following, but doing so > gives me an SPI_execution error: > BEGIN; > LOCK IN SHARE ROW EXCLUSIVE MODE; > lock adns_report_hour_history in share row exclusive mode; > INSERT INTO
VALUES ... - or - UPDATE
SET .... > COMMIT; > Will this make the next transaction wait until the previous transaction has > completed? Do I need to set any config parameters? > > If you can include an actual code snippet in the response, it would help ... what you want is to set the xaction isolation level. BEGIN; SET TRANSACTION ISOLATION LEVEL SERIALIZABLE; ...... COMMIT; Be prepared for serialization failures though. > > > > ---------------------------(end of broadcast)--------------------------- > TIP 2: Don't 'kill -9' the postmaster > -- -Achilleus