X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 06CFAD85A4 for ; Tue, 22 Nov 2005 05:14:09 -0400 (AST) 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 51810-02 for ; Tue, 22 Nov 2005 09:14:10 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail.metronet.co.uk (mail.metronet.co.uk [213.162.97.75]) by svr1.postgresql.org (Postfix) with ESMTP id BDA6DD6833 for ; Tue, 22 Nov 2005 05:14:06 -0400 (AST) 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 B2ACB4177E2; Tue, 22 Nov 2005 09:14:00 +0000 (GMT) Received: from [192.168.1.17] (client17.office.archonet.com [192.168.1.17]) by mainbox.archonet.com (Postfix) with ESMTP id CA44F15EA4; Tue, 22 Nov 2005 09:14:04 +0000 (GMT) Message-ID: <4382E15C.5070206@archonet.com> Date: Tue, 22 Nov 2005 09:14:04 +0000 From: Richard Huxton User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051013) X-Accept-Language: en-us, en MIME-Version: 1.0 To: gry@ll.mit.edu Cc: pgsql-sql@postgresql.org Subject: Re: tid_le comparison for tuple id (ctid) values? References: <20051121160016.282c66c2.gry@ll.mit.edu> <4271.1132607968@sss.pgh.pa.us> <20051121203527.5378122b.gry@ll.mit.edu> In-Reply-To: <20051121203527.5378122b.gry@ll.mit.edu> 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, score=0 required=5 tests=[AWL=0.000] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200511/188 X-Sequence-Number: 23439 george young wrote: > Well, I don't have any need for it to correlate with the age of the > tuple. My use of step.ctid latest row, but just to *choose* one. Perhaps there's some other > query that would modify only one of each pair of equal-keyed rows? How do you know there is only 1 duplicate? Anyway, if (x,y) are the same but (z) is not then you can compare against max(z) or min(z). Something like: SELECT t1.x AS update_me_x, t1.y AS update_me_y, t1.z AS update_me_z FROM test_tbl AS t1, ( SELECT x,y,max(z) AS max_z FROM test_tbl GROUP BY x,y ) AS t2 WHERE t1.x = t2.x AND t1.y = t2.y AND t1.z = t2.max_z -- Richard Huxton Archonet Ltd