Re: group by true now errors with non-integer constant in GROUP BY
От | Laurenz Albe |
---|---|
Тема | Re: group by true now errors with non-integer constant in GROUP BY |
Дата | |
Msg-id | 10a3ef130cd6d757690be076a6f47fe9351026d2.camel@cybertec.at обсуждение исходный текст |
Ответ на | Re: group by true now errors with non-integer constant in GROUP BY (Vik Fearing <vik@postgresfriends.org>) |
Ответы |
Re: group by true now errors with non-integer constant in GROUP BY
|
Список | pgsql-bugs |
On Fri, 2023-10-20 at 07:44 +0200, Vik Fearing wrote: > > But according to my reading of the SQL standard, it only allows for > > regular column references in GROUP BY. Unless I got something wrong, > > that would mean the the ball is in Hibernate's court. It ought to > > produce correct SQL. > > The answer is not as easy as that. It is true that the standard > requires a <column reference> for each element of the GROUP BY clause, > but it is also true that PostgreSQL allows arbitrary expressions. > > Why is this non-standard query allowed: > > vik=# select true group by true or true; > ?column? > ---------- > t > (1 row) > > > but not this one? > > vik=# select true group by true; > ERROR: non-integer constant in GROUP BY > LINE 1: select true group by true; > ^ > > I may have oversimplified this example, but as long as the value is > present in the SELECT, logic would dictate that we can group by it. I agree that it is desirable to fix this regression. Still, we shouldn't exonerate Hibernate from fixing the junk SQL it produces. Yours, Laurenz Albe
В списке pgsql-bugs по дате отправления: