Browse Source

! PostgreSQL doesn't like sorting by non-integer constants

Signed-off-by: Michael Eshom <[email protected]>
Michael Eshom 10 years ago
parent
commit
e83fe185d8
2 changed files with 4 additions and 1 deletions
  1. 3 0
      Sources/Subs-Db-postgresql.php
  2. 1 1
      cron.php

+ 3 - 0
Sources/Subs-Db-postgresql.php

@@ -287,6 +287,9 @@ function smf_db_query($identifier, $db_string, $db_values = array(), $connection
 		'consolidate_spider_stats' => array(
 			'~MONTH\(log_time\), DAYOFMONTH\(log_time\)~' => 'MONTH(CAST(CAST(log_time AS abstime) AS timestamp)), DAYOFMONTH(CAST(CAST(log_time AS abstime) AS timestamp))',
 		),
+		'cron_find_task' => array(
+			'~ORDER BY null~' => 'ORDER BY null::int'
+		),
 		'delete_subscription' => array(
 			'~LIMIT 1~' => '',
 		),

+ 1 - 1
cron.php

@@ -132,7 +132,7 @@ function fetch_task()
 	// Try to find a task. Specifically, try to find one that hasn't been claimed previously, or failing that,
 	// a task that was claimed but failed for whatever reason and failed long enough ago. We should not care
 	// what task it is, merely that it is one in the queue, the order is irrelevant.
-	$request = $smcFunc['db_query']('', '
+	$request = $smcFunc['db_query']('cron_find_task', '
 		SELECT id_task, task_file, task_class, task_data, claimed_time
 		FROM {db_prefix}background_tasks
 		WHERE claimed_time < {int:claim_limit}