From: | hubert depesz lubaczewski <depesz(at)depesz(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: unhelpful error message |
Date: | 2009-06-18 14:06:59 |
Message-ID: | 20090618140659.GB5113@depesz.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Thu, Jun 18, 2009 at 10:03:21AM -0400, Tom Lane wrote:
> hubert depesz lubaczewski <depesz(at)depesz(dot)com> writes:
> > # 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;
>
> > shown error:
> > 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...
> > ^
>
> Per the fine manual, sp.count is another way of writing count(sp).
> Does it make more sense now?
I know why it works that way. But it took me while to figure it out, and
the select sp.count from table sp, seems to be rather hacky thing, not
really well known, and of no big use.
Best regards,
depesz
--
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
From | Date | Subject | |
---|---|---|---|
Next Message | Kevin Grittner | 2009-06-18 14:50:24 | Re: unhelpful error message |
Previous Message | Tom Lane | 2009-06-18 14:03:21 | Re: unhelpful error message |