VIEWS, DISTINCT and COUNT - Mailing list pgsql-hackers

From Brian Hirt
Subject VIEWS, DISTINCT and COUNT
Date
Msg-id 19991103181331.A8318@loopy.berkhirt.com
Whole thread Raw
Responses Re: [HACKERS] VIEWS, DISTINCT and COUNT  ("Oliver Elphick" <olly@lfix.co.uk>)
Re: [HACKERS] VIEWS, DISTINCT and COUNT  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Okay,

I'm used to a feature that allows combining count and distinct in Sybase. 
I thought it was standard SQL and expected to see it in Postgres.  Whatever
the case might be, postgres does not seem to support this.  I keep running
into queries that I cannot write.  Here's the skinny:

"select count(distinct id) from table" is not supported.  Getting this
information without count(distinct id) support is a pain and always seems
to require creating temporary table and running queries later.  My first
solution was to create a view that just selected the distinct colmuns that
I was interested in and then do a count on that table.  This too seems
impossible.

For both count(distinct) and distinct in views, I have this question:  Is 
this something that needs to be supported but just never got implemented?
Or, is it something that was conciously excluded?  If nobody is working on 
these, I may take a look them and pick the easier to implement.  What little
I know about the way postgres works, I expect the first one would be esier.


-- 
The world's most ambitious and comprehensive PC game database project.
                     http://www.mobygames.com


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] getting new serial value of serial insert
Next
From: "Oliver Elphick"
Date:
Subject: Re: [HACKERS] VIEWS, DISTINCT and COUNT