Re: unhelpful error message

Поиск
Список
Период
Сортировка
От hubert depesz lubaczewski
Тема Re: unhelpful error message
Дата
Msg-id 20090618140659.GB5113@depesz.com
обсуждение исходный текст
Ответ на Re: unhelpful error message  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
On Thu, Jun 18, 2009 at 10:03:21AM -0400, Tom Lane wrote:
> hubert depesz lubaczewski <depesz@depesz.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@depesz.com / aim:depeszhdl / skype:depesz_hdl / gg:6749007

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: unhelpful error message
Следующее
От: "Kevin Grittner"
Дата:
Сообщение: Re: unhelpful error message