I tested it on 8.3.7 and on 8.4, but it doesn't seem to be version
steps to reproduce:
# create table sold_products (items int4, product_id int4);
# create table products (id int4, codename text);
# select sp.count, p.codename from sold_products sp join products p on sp.product_id = p.id;
ERROR: column "p.codename" must appear in the GROUP BY clause or be used in an aggregate function
LINE 1: select sp.count, p.codename from sold_products sp join produ...
Now - the problem is that I "forgot" name of the column, thought it will be "count", but it's "items".
the error doesn't say that I used column that doesn't exist - it says something about grouping.
I know it is related to the fact that this works:
select sp.count from sold_products sp;
but i'm not sure if it this (rather obscure) functionality is really worth the trouble.
Linkedin: http://www.linkedin.com/in/depesz / blog: http://www.depesz.com/
jid/gtalk: depesz(at)depesz(dot)com / aim:depeszhdl / skype:depesz_hdl / gg:6749007
pgsql-bugs by date
|Next:||From: Tom Lane||Date: 2009-06-18 14:03:21|
|Subject: Re: unhelpful error message |
|Previous:||From: Simon Riggs||Date: 2009-06-18 06:38:27|
|Subject: Re: [HACKERS] Cannot use all four trigger events at once|