From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Joseph Shraibman <jks(at)selectacast(dot)net> |
Cc: | "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: possible bug with group by? |
Date: | 2000-05-24 23:07:47 |
Message-ID: | 13008.959209667@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Joseph Shraibman <jks(at)selectacast(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Stephan Szabo | 2000-05-24 23:16:06 | Re: possible bug with group by? |
Previous Message | Ryan Bradetich | 2000-05-24 23:05:58 | Use of index in 7.0 vs 6.5 |