views:

24

answers:

1

I'm having trouble getting the reports_as_sparkline plugin working on PostgreSQL (it works fine on SQLite).

Here's an example error:

>> 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

Thoughts?

+3  A: 

Drop the backticks `, use single quotes '. In SQL only single and double quotes are allowd, single quotes for values, double quotes for database objects like table names, column names, etc.

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
Frank Heikens