From b518a3ff8747c15be277ff581f79dca72992f33f Mon Sep 17 00:00:00 2001 From: markjcrane Date: Tue, 20 Oct 2015 02:05:03 -0600 Subject: [PATCH] Change the way null last is done for Postgres. --- app/contacts/contacts.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/contacts/contacts.php b/app/contacts/contacts.php index 000127b555..82ebd227d9 100644 --- a/app/contacts/contacts.php +++ b/app/contacts/contacts.php @@ -178,7 +178,10 @@ else { $sql .= "order by ".$order_by." ".$order." "; } else { - $sql .= "order by case when last_mod_date is null then 1 else 0, last_mod_date desc "; + $sql .= "order by last_mod_date desc "; + if ($db_type == "pgsql") { + $sql .= "nulls last "; + } } $sql .= "limit ".$rows_per_page." offset ".$offset." "; $prep_statement = $db->prepare(check_sql($sql));