Skip site navigation (1) Skip section navigation (2)

SELECT DISTINCT on boxes

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Bugs for PostgreSQL <pgsql-bugs(at)postgreSQL(dot)org>
Subject: SELECT DISTINCT on boxes
Date: 2004-07-14 17:03:26
Message-ID: 200407141703.i6EH3Ql27539@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
Is there a way to do a SELECT DISTINCT on boxes:

        test=> create TABLE t3 (a box);
        CREATE TABLE
        test=> insert into t3 values ('(2,2),(1,1)');
        INSERT 17232 1
        test=> insert into t3 values ('(2,2),(1,1)');
        INSERT 17233 1
        test=> insert into t3 values ('(3,3),(2,2)');
        INSERT 17234 1
        test=> insert into t3 values ('(3,3),(2,2)');
        INSERT 17235 1
        test=> select distinct * from t3;
        ERROR:  could not identify an ordering operator for type box
        HINT:  Use an explicit ordering operator or modify the query.

I tried doing subqueries and using oids but that didn't help.

I don't understand why this doesn't work:

	SELECT a 
	FROM t3 t2
	WHERE t2.oid = (SELECT MIN(t.oid) FROM t3 t WHERE t2.a = t.a);

	      a
	-------------
	 (2,2),(1,1)
	(1 row)

If finds only the duplicate.

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman(at)candle(dot)pha(dot)pa(dot)us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Responses

pgsql-bugs by date

Next:From: Aaron HillegassDate: 2004-07-14 18:53:50
Subject: Large object API problems
Previous:From: PostgreSQL Bugs ListDate: 2004-07-14 13:38:55
Subject: BUG #1193: Some query sequences do not finish

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group