On Mon, Apr 09, 2012 at 13:55:04 -0400,
Michael Gould <mgould@xxxxxxxxxxxxxxxxxxxx> wrote:
Thanks that is a help. I would be nice if any key could be used as those are normally the things I would do group by's
This is what the 9.1 documentation says:
"When GROUP BY is present, it is not valid for the SELECT list expressions to
refer to ungrouped columns except within aggregate functions or if the
ungrouped column is functionally dependent on the grouped columns, since
there would otherwise be more than one possible value to return for an
ungrouped column. A functional dependency exists if the grouped columns (or
a subset thereof) are the primary key of the table containing the ungrouped
column."
That implies you need to group by a primary key. I haven't tested if
that (other keys can't provide this) is actually the case.
--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general