From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
---|---|
To: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | asterisk (non)expansion in GROUP BY clause |
Date: | 2011-05-19 20:08:33 |
Message-ID: | 1305835713.3952.14.camel@vanquo.pezone.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Apparently, you can write this (an attempt at a convenient workaround
for lack of functional dependency tracking pre-9.1):
SELECT pg_class.* FROM pg_class GROUP BY pg_class.*;
It won't work:
ERROR: 42803: column "pg_class.relname" must appear in the GROUP BY clause or be used in an aggregate function
But the whole thing is a bit confusing. This works (of course):
SELECT pg_class FROM pg_class GROUP BY pg_class;
And this behaves equivalently, apparently:
SELECT pg_class FROM pg_class GROUP BY pg_class.*;
Is there any rhyme or reason for this? I couldn't find anything about
this in the documentation or in the SQL standard. I guess the whole
thing is inconsistent all over the place; I'd just like to verify that
the current behavior is somewhat intentional.
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2011-05-19 20:13:12 | Re: LOCK DATABASE |
Previous Message | Robert Haas | 2011-05-19 19:53:39 | Re: moving toast table to its own tablespace |