X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 568995E46C1 for ; Tue, 17 Aug 2004 11:24:52 -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 94021-06 for ; Tue, 17 Aug 2004 14:24:48 +0000 (GMT) Received: from simmts5-srv.bellnexxia.net (simmts5.bellnexxia.net [206.47.199.163]) by svr1.postgresql.org (Postfix) with ESMTP id 3744B5E46C3 for ; Tue, 17 Aug 2004 11:24:45 -0300 (ADT) Received: from localhost ([67.71.24.121]) by simmts5-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP id <20040817142324.BYCS1635.simmts5-srv.bellnexxia.net@localhost>; Tue, 17 Aug 2004 10:23:24 -0400 Received: from sympatico.ca ([192.168.250.6]) by (8.11.6/8.11.6) with ESMTP id i7HEOmg03956; Tue, 17 Aug 2004 10:24:49 -0400 Message-ID: <41221580.7070907@sympatico.ca> Date: Tue, 17 Aug 2004 10:26:08 -0400 From: Jean-Luc Lachance User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax) X-Accept-Language: en, en-us, en-gb, fr, fr-ca MIME-Version: 1.0 To: Markus Bertheau Cc: pgsql-sql@postgresql.org Subject: Re: SELECT MAX(c) FROM (SELECT ... FOR UPDATE) AS foo References: <1092740863.2627.17.camel@dicaprio.akademie1.de> In-Reply-To: <1092740863.2627.17.camel@dicaprio.akademie1.de> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200408/166 X-Sequence-Number: 18663 This query does not make sense to me. Why would you create an updatable subquery just to get the highest value? Maybe you are trying to achieve something other than what the query suggest. You wou care to put in words what you want to do? JLL Markus Bertheau wrote: > Hi, > > why is the following query not allowed: > > SELECT MAX(position) FROM (SELECT position FROM classes WHERE name = > 'foo' FOR UPDATE OF classes) AS foo > > It's clear which rows should be locked here, I think. > > Thanks >