From: Richard Huxton <dev@archonet.com>
To: gry@ll.mit.edu
Cc: pgsql-sql@postgresql.org
Subject: Re: tid_le comparison for tuple id (ctid) values?
Date: Tue, 22 Nov 2005 09:14:04 +0000
Message-ID: <4382E15C.5070206@archonet.com> (raw)
In-Reply-To: <20051121203527.5378122b.gry@ll.mit.edu>
References: <20051121160016.282c66c2.gry@ll.mit.edu>
<4271.1132607968@sss.pgh.pa.us>
<20051121203527.5378122b.gry@ll.mit.edu>
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<s.ctid was not to get the earliest or
> 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: dev@archonet.com, gry@ll.mit.edu
Subject: Re: tid_le comparison for tuple id (ctid) values?
In-Reply-To: <4382E15C.5070206@archonet.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox