2012-02-15 118 views
0

[编辑:这问题是版本内的一个错误的结果3.7.6]碧玉报告:错误:操作符不存在日期=布尔

以下PostgreSQL的查询将返回一个错误:

operator does not exist date = boolean. 

我不明白为什么。这是postgresql代码给我的错误:

select 
    c.source, 
    s.name, 
    s.grouping, 
    s.kli, 
    s.term_desc, 
    (s.population - s.online) as non_hb_pop, 
    s.online as hb_pop, 
    s.population as full_pop, 
    s.rep_date 

from 
    dwh.rpt_cu_private_kli_summary s, dwh.rpt_sgmt_clients c 
where 

    s.partner_id::integer = $P{rpt_cu} 
    and s.rep_date = $P{rpt_date_beg} 
    and s.userid=c.userid 

group by 
    c.source, s.term_desc, s.name, s.grouping, 
    s.population, s.online, s.kli, s.rep_date 
order by 
    s.grouping, 
    full_pop desc, 
    s.term_desc; 

上面的错误信息是什么意思?

+1

“group by”的用途是什么?我看不到使用的聚合体。 – wildplasser 2012-02-15 14:48:27

+0

我以前正在使用聚合,然后在没有除掉GROUP BY的情况下将它们取出。谢谢你指出了我! – precose 2012-02-15 14:54:25

+0

启用查询日志记录并在PostgreSQL日志之外的参数替换后执行查询。发布。您还需要包含以下显示参数的日志行。设置log_statement ='all',重新加载PostgreSQL,重新运行你的查询,钓鱼查询和params出日志,并粘贴在这里。 – 2012-02-21 23:23:39

回答

2

$ P {rpt_date_beg}的值是多少?这是事情出错的地方。检查真正的查询,可能在错误日志中,并进行一些调试。在日期值周围可能缺少一些引号。

+0

$ P {rpt_date_beg}被设置为'Date',它就是postgres数据库中的内容。这些字段看起来像这个2012-01-16。即使我在输入查询时收到错误,仍然按OK。一旦我回来编辑查询,错误消失,除非我输入新的东西。我不确定它是否是一个错误。 – precose 2012-02-15 14:33:15