]> git.mjollnir.org Git - s9y.git/commitdiff
* Fix putting sticky entry on the last page in postgreSQL setups.
authorgarvinhicking <garvinhicking>
Thu, 25 Aug 2005 14:50:23 +0000 (14:50 +0000)
committergarvinhicking <garvinhicking>
Thu, 25 Aug 2005 14:50:23 +0000 (14:50 +0000)
      Thanks to Nate Johnston for working this out! (garvinhicking)

docs/NEWS
plugins/serendipity_event_entryproperties/serendipity_event_entryproperties.php

index b037be835ec1fe5e7bf5f39d9d28a4ac01e3e0fa..26138b7aba12be22b4dd51eafcee60896e3cd3ed 100644 (file)
--- a/docs/NEWS
+++ b/docs/NEWS
@@ -3,6 +3,9 @@
 Version 0.9 ()
 ------------------------------------------------------------------------
 
+    * Fix putting sticky entry on the last page in postgreSQL setups.
+      Thanks to Nate Johnston for working this out! (garvinhicking)
+
     * Make "/archive" view also recognize selected category. Sidebar
       archive and calendar plugins also pay strict attention to which
       category is selected. Helps "semi-multiple" blogs based on categories
index 9456eb54742d0947b993d39f283f4c527e4142f8..2d35663935799d4869df48ab26e64bd02104092b 100644 (file)
@@ -536,7 +536,16 @@ class serendipity_event_entryproperties extends serendipity_event
                         $eventData['addkey'] .= $cond;
                     }
 
-                    $cond = 'orderkey DESC';
+                    if ($serendipity['dbType'] == 'postgres') {
+                        // PostgreSQL is a bit weird here. Empty columns with NULL or "" content for 
+                        // orderkey would get sorted on top when using DESC, and only after those 
+                        // the "true" content would be inserted. Thus we order ASC in postgreSQL, 
+                        // and silently wonder. Thanks to Nate Johnston for working this out!
+                        $cond = 'orderkey ASC';
+                    } else {
+                        $cond = 'orderkey DESC';
+                    }
+
                     if (empty($eventData['orderby'])) {
                         $eventData['orderby'] = $cond;
                     } else {