X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id ECBD5D7D40 for ; Wed, 12 Oct 2005 11:01:00 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 18065-06 for ; Wed, 12 Oct 2005 14:00:53 +0000 (GMT) Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by svr1.postgresql.org (Postfix) with ESMTP id 8DCB2D7D59 for ; Wed, 12 Oct 2005 11:00:55 -0300 (ADT) Received: from mainbox.archonet.com (84-51-143-99.archon037.adsl.metronet.co.uk [84.51.143.99]) by smtp.metronet.co.uk (MetroNet Mail) with ESMTP id 8547A440500; Wed, 12 Oct 2005 15:00:16 +0100 (BST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id 4FB9315ED9; Wed, 12 Oct 2005 14:58:18 +0100 (BST) Received: from mainbox.archonet.com ([127.0.0.1]) by localhost (mainbox [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 24554-03; Wed, 12 Oct 2005 14:58:14 +0100 (BST) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id B623115ED5; Wed, 12 Oct 2005 14:58:14 +0100 (BST) Message-ID: <434D1676.3010509@archonet.com> Date: Wed, 12 Oct 2005 14:58:14 +0100 From: Richard Huxton User-Agent: Thunderbird 1.4.1 (X11/20051006) MIME-Version: 1.0 To: Thomas Rokohl Cc: pgsql-odbc@postgresql.org Subject: Re: lock - feedback References: <434CEB1A.4050102@raygina.de> <434CF612.8010705@archonet.com> <434CFB5E.6000402@raygina.de> <434D0847.3080908@archonet.com> <434D0DF9.3010702@raygina.de> In-Reply-To: <434D0DF9.3010702@raygina.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.059 required=5 tests=[AWL=0.009, FORGED_RCVD_HELO=0.05] X-Spam-Level: X-Archive-Number: 200510/61 X-Sequence-Number: 6163 Thomas Rokohl wrote: >>> >>> so but i'm not sure, doesn't it mean that all statements that take >>> longer than this time will be abort? >>> if it is so, that isn't a solution for this problem because than i >>> can't make a "big" request anymore. >> >> You can change it during a session "set statement_timeout=2000" >> > yes, but that isn't a certain event that say that the data is locked! > also the network for example can determine different timeouts. Yes, but network timeouts will be of the order of several minutes - hours. You're not holding your locks for that long are you? Are you really saying your SELECT FOR UPDATE queries can take more than a couple of seconds to complete? > and also i don't know the working time for each request before. > that isn't a solution for me. i will open a "please wait, while the data > is locked" - window, if the data is locked. So, you want to write code something like: WHILE (still_trying) SELECT ... FOR UPDATE IF (failed) THEN IF (errcode=lock) THEN display_please_wait_message() ELSE display_error_message_and_abort() END IF ELSE got_lock = true END IF END WHILE IF got_lock THEN do_my_updates() END IF All I'm saying is around "SELECT ... FOR UPDATE" you put two "SET statement_timeout" to set a short timeout and then revert it. > and it seems as if this should be a problem with postgres :-( Perhaps - you can apply NOWAIT to "LOCK TABLE" and I think in 8.1 to "SELECT FOR UPDATE" also. That's not much use if you're stuck with 8.0 for the moment though. It also doesn't actually change the logic of the code above. Or am I missing something here? -- Richard Huxton Archonet Ltd