Re: possible bug with group by?
| От | Tom Lane |
|---|---|
| Тема | Re: possible bug with group by? |
| Дата | |
| Msg-id | 13008.959209667@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | possible bug with group by? (Joseph Shraibman <jks@selectacast.net>) |
| Список | pgsql-sql |
Joseph Shraibman <jks@selectacast.net> writes:
> playpen=> select a, b, case when c is null then 'not set' else 'set' end
> as z from tablea group by a, b, z;
> ERROR: Unable to identify an operator '<' for types 'unknown' and 'unknown'
> You will have to retype this query using an explicit cast
It's not GROUP BY's fault, it's just the oft-repeated issue about
quoted string literals not having any definite type in Postgres.
The parser postpones assigning a type until it sees the literal used
in a context where a type can be determined --- and in a case like
this, it never can. You need to force the issue with a cast, eg
select a, b, case when c is null then 'not set'::text else 'set'::text end as z
from tablea group by a, b, z;
regards, tom lane
В списке pgsql-sql по дате отправления: