]> git.joonet.de Git - adminer.git/commitdiff
Select: Allow ordering by COUNT(*) (fix #966, regression from 5.0.2)
authorJakub Vrana <jakub@vrana.cz>
Wed, 2 Apr 2025 16:00:32 +0000 (18:00 +0200)
committerJakub Vrana <jakub@vrana.cz>
Wed, 2 Apr 2025 16:01:14 +0000 (18:01 +0200)
CHANGELOG.md
adminer/select.inc.php

index e6789f3e00a57e0e2bc02f3bc1115da2b88b9af0..9533b2bb9fbf6395e150e07ba37014c3d519b63f 100644 (file)
@@ -1,5 +1,6 @@
 ## Adminer dev
 - Export: Fix tar (regression from 5.0.3)
+- Select: Allow ordering by COUNT(*) (bug #966, regression from 5.0.2)
 - Optimize retrieving columns for schema
 - Elasticsearch: Make it work with Elasticsearch 8
 - CSS: Hide menu on mobile
index 0fbe7ba47c06763c792124bd6da738ed9ca6b64c..1324f61e1e4a0eea05329ea3b74886914b1be46d 100644 (file)
@@ -350,9 +350,9 @@ if (!$columns && support("table")) {
                                                $column = idf_escape($key);
                                                $href = remove_from_uri('(order|desc)[^=]*|page') . '&order%5B0%5D=' . urlencode($key);
                                                $desc = "&desc%5B0%5D=1";
-                                               $sortable = isset($field["privileges"]["order"]);
                                                echo "<th id='th[" . h(bracket_escape($key)) . "]'>" . script("mixin(qsl('th'), {onmouseover: partial(columnMouse), onmouseout: partial(columnMouse, ' hidden')});", "");
                                                $fun = apply_sql_function($val["fun"], $name); //! columns looking like functions
+                                               $sortable = isset($field["privileges"]["order"]) || $fun;
                                                echo ($sortable ? '<a href="' . h($href . ($order[0] == $column || $order[0] == $key || (!$order && $is_group && $group[0] == $column) ? $desc : '')) . '">' . "$fun</a>" : $fun); // $order[0] == $key - COUNT(*)
                                                echo "<span class='column hidden'>";
                                                if ($sortable) {