I will start with test case:
Code: Select all
create table test_tab{
date_field date,
int_field integer,
real_field numeric(18,6)
WITH (
OIDS=FALSE
);
now in application execute query like this:
Code: Select all
select case when coalesce(:date_grp,false) = true then date_field else null end as date_field, sum(int_field) as int_field, sum(real_field) as real_field
from test_tab
group by case when coalesce(:date_grp,false) = true then date_field else null end
When i execute it i get error:
2014-09-22 23:38:01 CEST ERROR: column "test_tab.date_field" must appear in the GROUP BY clause or be used in an aggregate function at character 49
2014-09-22 23:38:01 CEST STATEMENT: select case when coalesce($1,false) = true then date_field else null end as date_field, sum(int_field) as int_field, sum(real_field) as real_field from test_tab group by case when coalesce($2,false) = true then date_field else null end ORDER BY int_field asc LIMIT 100 OFFSET 0
but what is more interesting, queries like:
Code: Select all
select *
from test_tab tt
where case when :int1 is not null then int_field > :int1 else true end
and case when :int2 is not null then real_field < :int2 else true end
I've located that this error occured first in revision 2432, when #define ZEOS_TEST_ONLY was introduced.
Best regards,
Marek