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

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: Slightly confused error message



On Fri, 28 Apr 2006 12:07:04 -0400, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Markus Schaber <schabi(at)logix-tt(dot)com> writes:
>> I just stumbled over a slightly confused error message:
> 
>> mydb=# select count(*),coverage_area from myschema.streets except select
>> cd as coverage_area from countryref.disks group by
> streets.coverage_area;
>> ERROR:  column "streets.coverage_area" must appear in the GROUP BY
>> clause or be used in an aggregate function
> 
>> As the query looks, streets.coverage_area is actually used in the GROUP
> BY.
> 
> The complaint is 100% accurate; the subquery that it's unhappy about is
> 
> 	select count(*),coverage_area from myschema.streets
> 
> which is an aggregating query, but coverage_area is being used outside
> an aggregate without having been grouped by.

I see lack of parenthesis in the sub-query:

select count(*),coverage_area from myschema.streets except
    (select cd as coverage_area from countryref.disks)
       group by streets.coverage_area;

-- 
---------------------------------------------------------
Lic. Martín Marqués         |   SELECT 'mmarques' || 
Centro de Telemática        |       '@' || 'unl.edu.ar';
Universidad Nacional        |   DBA, Programador, 
    del Litoral             |   Administrador
---------------------------------------------------------





Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group