when looking at sales reports, you get a series of error messages:

warning: pg_query() [function.pg-query]: Query failed: ERROR: operator does not exist: timestamp without time zone ~~ unknown LINE 1: ...tatus IN ('completed') AND FROM_UNIXTIME(created) LIKE '2009... ^ HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts. in /var/www/drupal-6.8/includes/database.pgsql.inc on line 139.

user warning: query: SELECT o.order_total FROM uc_orders as o WHERE o.order_status IN ('completed') AND FROM_UNIXTIME(created) LIKE '2009-01-15%' in /var/www/drupal-6.8/sites/all/modules/ubercart/uc_reports/uc_reports.module on line 260.

(and in some other nearby places as well)

FROM_UNIXTIME appears to be MySQL-specific. Since the “created” field is already stored as a unix date (seconds since 1/1/70), and the $time variable is also stored that way, we can change the queries to take advantage of that. (And it will theoretically be quicker.)
For example, at line 260:

$sql_frag = " FROM {uc_orders} as o WHERE o.order_status IN $order_statuses AND FROM_UNIXTIME(created) LIKE '". format_date($time, 'custom', 'Y') .'-'. format_date($time, 'custom', 'm') .'-'. format_date($time, 'custom', 'd') ."%%'";

becomes:

$sql_frag = " FROM {uc_orders} as o WHERE o.order_status IN $order_statuses AND created >= ". strval($time);

(be sure to make this fix at line 260, line 265 and line 270

Comments

Island Usurper’s picture

Version: 6.x-2.0-beta2 » 6.x-2.0-beta3
Status: Active » Fixed

These custom functions have already been removed. Make sure you have run update.php, because I believe they weren't in the beta2 version either.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.