From fa52c994a6f1ddbf0c596e232b9f621e85092a5d Mon Sep 17 00:00:00 2001 From: Damien Regad Date: Tue, 20 Aug 2013 23:46:32 +0200 Subject: [PATCH] due_date ASC sort: pgsql fix Fix #16259: adding order by expression to select list to avoid error. --- core/filter_api.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/filter_api.php b/core/filter_api.php index a79c4d9231..4d12ac0165 100644 --- a/core/filter_api.php +++ b/core/filter_api.php @@ -958,7 +958,9 @@ function filter_get_query_sort_data( &$p_filter, $p_show_sticky, $p_query_clause # when sorting by due_date, always display undefined dates last if( 'due_date' == $c_sort && 'ASC' == $c_dir ) { - $t_sort_col = "$t_sort_col = 1, $t_sort_col"; + $t_sort_due_date = "$t_sort_col = 1"; + $p_query_clauses['select'][] = $t_sort_due_date; + $t_sort_col = "$t_sort_due_date, $t_sort_col"; } $p_query_clauses['order'][] = "$t_sort_col $c_dir";