From 948d57bb636bccc0886a15f4d2c3ba3ad0af98a4 Mon Sep 17 00:00:00 2001 From: Jakub Vrana Date: Thu, 5 Feb 2026 14:01:05 +0100 Subject: [PATCH] Shorten all but numeric and date types in select --- CHANGELOG.md | 1 + adminer/include/functions.inc.php | 2 +- plugins/drivers/igdb.php | 5 +++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 64260d43..41b939f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - Improve print of nested tables - Hide sort links on unsortable columns - Display uneditable fields in edit form +- Shorten all but numeric and date types in select - PostgreSQL: Offer foreign keys in create table - PostgreSQL: Add missing parentheses to CHECK export - PostgreSQL: Allow creating NOT DEFERRABLE foreign keys diff --git a/adminer/include/functions.inc.php b/adminer/include/functions.inc.php index f605d74d..75859f7f 100644 --- a/adminer/include/functions.inc.php +++ b/adminer/include/functions.inc.php @@ -846,7 +846,7 @@ function is_url(?string $string): bool { * @param array{type: string} $field */ function is_shortable(array $field): bool { - return preg_match('~char|text|json|lob|geometry|point|linestring|polygon|string|bytea|hstore~', $field["type"]); + return !preg_match('~' . number_type() . '|date|time|year~', $field["type"]); } /** Split server into host and (port or socket) diff --git a/plugins/drivers/igdb.php b/plugins/drivers/igdb.php index 430e0f2b..3bc7f607 100644 --- a/plugins/drivers/igdb.php +++ b/plugins/drivers/igdb.php @@ -180,7 +180,7 @@ if (isset($_GET["igdb"])) { if (preg_match('~^DEPRECATED!~', $comment)) { continue; } - $this->fields[$table]['id'] = array('full_type' => 'bigserial', 'comment' => ''); + $this->fields[$table]['id'] = array('full_type' => 'bigint', 'comment' => ''); $this->links[$link] = $table; $this->tables[$table] = array('Name' => $table, 'Comment' => $comment); foreach ($xpath->query('tbody/tr', $els[$i+2]) as $tr) { @@ -355,9 +355,10 @@ if (isset($_GET["igdb"])) { function fields($table) { $return = array(); foreach (driver()->fields[$table] ?: array() as $key => $val) { + $type = strtolower(preg_replace('~ .*~', '', $val['full_type'])); $return[$key] = $val + array( "field" => $key, - "type" => (preg_match('~^int|bool|enum~i', $val['full_type']) ? $val['full_type'] : 'varchar'), // shorten reference columns + "type" => ($type == 'reference' ? 'int' : $type), // align right reference columns "privileges" => array("select" => 1) + ($table == 'webhooks' ? array() : array("where" => 1, "order" => 1)), ); }