ORDER BY 子句在两台服务器上的不同效果

Different effects of ORDER BY clause on two servers

我的查询:

SELECT * FROM table GROUP BY id;

id字段当然是主键;

在 9.4.4 中我得到预期的错误:

column "table.name" must appear in the GROUP BY clause or be used in an aggregate function

但是!在 9.4.5 中它可以工作,就像在 MySQL 中一样。

谁能告诉我 - 为什么? :)

Postgres 版本在这里无关紧要。 table 不相同。在您的 9.4.5 table 中,列 id 很可能是主键,而在 9.4.4 中则不是。