ClickHouse: Fix offset (bug #1188)

Previously, the driver used `LIMIT <limit>, <offset>` syntax, causing incorrect
pagination behavior (page 2 repeating results from page 1, etc.). Updated the
`limit()` function to use ClickHouse-compatible `LIMIT <count> OFFSET <offset>`
syntax, ensuring correct row offsets across pages.
This commit is contained in:
Marcus Nightingale
2025-10-15 12:32:08 +01:00
committed by Jakub Vrana
parent c7ede7331e
commit 4d0e79234c
2 changed files with 2 additions and 1 deletions

View File

@@ -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)

View File

@@ -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") {