2010-03-03 74 views
1

我无法获得reports_as_sparkline plugin在PostgreSQL上工作(它在SQLite上工作正常)。PostgreSQL特定的错误报告_as_sparkline

下面是一个典型的错误:

>> Annotation.creations_report 
ActiveRecord::StatementInvalid: PGError: ERROR: operator does not exist: ` character varying 
LINE 1: ... grouping = E'day' AND aggregation = E'count' AND `condition... 
                  ^
HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. 
: SELECT * FROM "reports_as_sparkline_cache" WHERE (model_name = E'Annotation' AND report_name = E'creations' AND grouping = E'day' AND aggregation = E'count' AND `condition` = E'' AND reporting_period >= '2009-11-22') ORDER BY reporting_period ASC LIMIT 100 

的思考?

回答

3

删除反引号',使用单引号'。在SQL中,只允许使用单引号和双引号,值为单引号,数据库对象如表名,列名等的双引号。

SELECT * FROM "reports_as_sparkline_cache" WHERE (model_name = E'Annotation' AND report_name = E'creations' AND grouping = E'day' AND aggregation = E'count' AND condition = E'' AND reporting_period >= '2009-11-22') ORDER BY reporting_period ASC LIMIT 100