VIEWS, DISTINCT and COUNT

From: Brian Hirt <bhirt(at)mobygames(dot)com>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: VIEWS, DISTINCT and COUNT
Date: 1999-11-04 00:13:31
Message-ID: 19991103181331.A8318@loopy.berkhirt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Oliver Elphick 1999-11-04 00:52:44 Re: [HACKERS] VIEWS, DISTINCT and COUNT
Previous Message Tom Lane 1999-11-03 23:41:43 Re: [HACKERS] getting new serial value of serial insert