From 4d0e79234c59e62bcabc5625a9c5ed501e80950a Mon Sep 17 00:00:00 2001 From: Marcus Nightingale Date: Wed, 15 Oct 2025 12:32:08 +0100 Subject: [PATCH] ClickHouse: Fix offset (bug #1188) Previously, the driver used `LIMIT , ` syntax, causing incorrect pagination behavior (page 2 repeating results from page 1, etc.). Updated the `limit()` function to use ClickHouse-compatible `LIMIT OFFSET ` syntax, ensuring correct row offsets across pages. --- CHANGELOG.md | 1 + plugins/drivers/clickhouse.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e9eaea4..3a43faca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## Adminer dev - PostgreSQL: Mark unique partial indexes as unique (bug #1172) +- ClickHouse: Fix offset (bug #1188) - Plugins: Methods showVariables() and showStatus() (bug #1157) ## Adminer 5.4.1 (released 2025-09-26) diff --git a/plugins/drivers/clickhouse.php b/plugins/drivers/clickhouse.php index 7fa1d5fc..7cbd6a57 100644 --- a/plugins/drivers/clickhouse.php +++ b/plugins/drivers/clickhouse.php @@ -243,7 +243,7 @@ if (isset($_GET["clickhouse"])) { } function limit($query, $where, $limit, $offset = 0, $separator = " ") { - return " $query$where" . ($limit ? $separator . "LIMIT $limit" . ($offset ? ", $offset" : "") : ""); + return " $query$where" . ($limit ? $separator . "LIMIT " . ($offset ? "$offset, " : "") . $limit : ""); } function limit1($table, $query, $where, $separator = "\n") {