Hello,
while accessing the Sales Summary page for a user (e.g. /user/1/selling) I'm getting the following errors:
warning: pg_query(): Query failed: ERROR: function from_unixtime(integer) does not exist LINE 1: ...IN ('complete') AND n.uid = 1 AND sos.uid = 1 AND FROM_UNIXT... ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts. in /srv/www/ask.projects.metadosis.gr/includes/database.pgsql.inc on line 139.
user warning: query: SELECT p.cost, p.qty, sos.order_id FROM mp_seller_order_statuses AS sos LEFT JOIN uc_orders AS o ON sos.order_id = o.order_id LEFT JOIN uc_order_products AS p ON p.order_id = o.order_id LEFT JOIN node AS n ON n.nid = p.nid WHERE sos.order_status IN ('complete') AND n.uid = 1 AND sos.uid = 1 AND FROM_UNIXTIME(o.created) LIKE "2010-11-13%" in /srv/www/ask.projects.metadosis.gr/sites/all/modules/ubercart_marketplace/mp_reports/mp_reports.module on line 271.
warning: pg_query(): Query failed: ERROR: function from_unixtime(integer) does not exist LINE 1: ...IN ('complete') AND n.uid = 1 AND sos.uid = 1 AND FROM_UNIXT... ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts. in /srv/www/ask.projects.metadosis.gr/includes/database.pgsql.inc on line 139.
user warning: query: SELECT p.cost, p.qty, sos.order_id FROM mp_seller_order_statuses AS sos LEFT JOIN uc_orders AS o ON sos.order_id = o.order_id LEFT JOIN uc_order_products AS p ON p.order_id = o.order_id LEFT JOIN node AS n ON n.nid = p.nid WHERE sos.order_status IN ('complete') AND n.uid = 1 AND sos.uid = 1 AND FROM_UNIXTIME(o.created) LIKE "2010-11-12%" in /srv/www/ask.projects.metadosis.gr/sites/all/modules/ubercart_marketplace/mp_reports/mp_reports.module on line 271.
warning: pg_query(): Query failed: ERROR: function from_unixtime(integer) does not exist LINE 1: ...IN ('complete') AND n.uid = 1 AND sos.uid = 1 AND FROM_UNIXT... ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts. in /srv/www/ask.projects.metadosis.gr/includes/database.pgsql.inc on line 139.
user warning: query: SELECT p.cost, p.qty, sos.order_id FROM mp_seller_order_statuses AS sos LEFT JOIN uc_orders AS o ON sos.order_id = o.order_id LEFT JOIN uc_order_products AS p ON p.order_id = o.order_id LEFT JOIN node AS n ON n.nid = p.nid WHERE sos.order_status IN ('complete') AND n.uid = 1 AND sos.uid = 1 AND FROM_UNIXTIME(o.created) LIKE "2010-11%" in /srv/www/ask.projects.metadosis.gr/sites/all/modules/ubercart_marketplace/mp_reports/mp_reports.module on line 275.
The FROM_UNIXTIME SQL function is MySQL-specific. Drupal used to provide a substitute for PostgreSQL but doesn't anymore, considering its use as a function deprecated (see here for some comments from Dries and other Drupal core developers).
The Views module has worked around this by providing 3 functions dealing with database specific date queries in its views/includes/handlers.inc:
- views_date_sql_field()
- views_date_sql_format()
- views_date_sql_extract()
AFAICS Marketplace Reports currently has placeholders for database-dependent queries in mp_reports_get_sales(), although they do exactly the same thing for MySQL/PostgreSQL. Perhaps Marketplace Reports could introduce a dependency on Views and use its functions for dealing with this or even just plain copy/paste the functions.
Again AFAICS, Drupal core does not currently provide a way to deal with this. As I intend to produce a patch fixing this issue, I would like some advice on how to proceed.
Thanks,
Antonio
Comments
Comment #1
akanouras commentedChanging version as the relevant code is the same in -dev.
Also see here for the relevant Views issue.
Comment #2
akanouras commentedNo comment on this?
I would like to start working on it...
Comment #3
liam morland