Re: point types in "DISTINCT" queries - Mailing list pgsql-general

From Jonathan S. Katz
Subject Re: point types in "DISTINCT" queries
Date
Msg-id C0AEF0AB-4C42-4410-9F23-8BA0BCB3BC11@excoventures.com
Whole thread Raw
In response to Re: point types in "DISTINCT" queries  (Jeff Davis <pgsql@j-davis.com>)
List pgsql-general
> On Wed, 2011-06-29 at 11:37 -0400, Jonathan S. Katz wrote:
>> Which means it *should* work, but first I would need to clean up the data and find the duplicates.  I was hoping
thismight work: 
>>
>>     SELECT geocode, count(*)
>>     FROM a
>>     GROUP BY a.geocode
>>     HAVING count(*) > 1;
>
> Maybe you could use a self-join as a workaround for now, just to clean
> up the data?
>
> SELECT geocode, other_columns from a a1, a a2 where a1.other_columns <>
> a2.other_columns and a1.geocode ~= a2.geocode;

That worked perfectly - turned out it was just two rows.  And subsequently executing the exclusion constraint on "=~"
alsoworked perfectly as expected. 

The larger issue I face with now is slightly out of my control without further hacking.  I'm developing an app with
Djangoand I wrote an extension that allows me to use the point type natively in Python.  I ran into the original issue
whilean automatically generated query was executed in the admin section.  I know this could be viewed as something
pertainingto Django, but the goal I had in mind was making PostgreSQL functionality more accessible in a different
softwarelayer. 

I will find a workaround for the above, as I am sure I can do some application-level hacking.

Thanks for your help!

Jonathan

pgsql-general by date:

Previous
From: Scott Ribe
Date:
Subject: Re: Real type with zero
Next
From: Hiroshi Saito
Date:
Subject: Re: Windows x64 : How do I get OSSP-UUID.sql contrib for postgresql x64