pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Martin Marques <martin@bugs.unl.edu.ar>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Markus Schaber <schabi@logix-tt.com>
Cc: PostgreSQL SQL List <pgsql-sql@postgresql.org>
Subject: Re: Slightly confused error message
Date: Fri, 28 Apr 2006 13:36:19 -0300
Message-ID: <dafdc3e847f55e0a67d11c779bf013ec@localhost> (raw)
In-Reply-To: <1612.1146240424@sss.pgh.pa.us>
References: <1612.1146240424@sss.pgh.pa.us>


On Fri, 28 Apr 2006 12:07:04 -0400, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Markus Schaber <schabi@logix-tt.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
---------------------------------------------------------





view thread (5+ messages)  latest in thread

Message-ID: <dafdc3e847f55e0a67d11c779bf013ec@localhost>
Permalink:  ../dafdc3e847f55e0a67d11c779bf013ec@localhost/
Also on:    postgresql.org/message-id/dafdc3e847f55e0a67d11c779bf013ec@localhost

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: martin@bugs.unl.edu.ar, tgl@sss.pgh.pa.us, schabi@logix-tt.com
  Subject: Re: Slightly confused error message
  In-Reply-To: <dafdc3e847f55e0a67d11c779bf013ec@localhost>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox