Description
The data order is invalid in Adaptive Ordering mode:
It does not follow numerical descending order.
It also does not follow valid string lexicographical descending order.
The largest id value is incorrectly placed at the end of consecutive rows with identical prefixes, breaking the sort logic entirely.
DBeaver Version
Community Edition 26.0
Operating System
macOS Sequoia 15.2
Database and driver
PostgreSQL 17
Steps to reproduce
- Ensure Adaptive Ordering mode is enabled (this is the default behavior for sorting table data in DBeaver).
- Connect to PostgreSQL database, and open the Data tab for a table with a bigserial primary key column.
- Click the downward arrow (↓) next to the id column header to trigger a descending sort.
- Observe the order of the returned data rows.
- Data should be sorted strictly in numerical descending order (largest to smallest) by the id column, even when using in-memory Adaptive Ordering.
For example, for the 3 rows in the screenshot (rows 4-6), the correct descending order should be:
Row 4: 2030565120120958979 (largest value)
Row 5: 2030565120120958978
Row 6: 2030565120120958977 (smallest value)
Sample data , DDL and screenshot are shown as follows:
local_message.sql
Additional context
- This issue is consistently reproduced on Windows 11, PostgreSQL 13, and DBeaver CE 25.3 and older versions.
- We have confirmed the id column is a native bigserial numerical type, not a string/varchar type.
This issue only occurs in Adaptive Ordering mode. If we disable Adaptive Ordering and force a server-side ORDER BY id DESC, the sorting works correctly.
- We suspect DBeaver's in-memory sorting logic is incorrectly treating the 64-bit bigserial integer as a string or failing to handle its full numerical precision, leading to the broken order.
Thanks for your time and help to look into this issue!
Description
The data order is invalid in Adaptive Ordering mode:
It does not follow numerical descending order.
It also does not follow valid string lexicographical descending order.
The largest id value is incorrectly placed at the end of consecutive rows with identical prefixes, breaking the sort logic entirely.
DBeaver Version
Community Edition 26.0
Operating System
macOS Sequoia 15.2
Database and driver
PostgreSQL 17
Steps to reproduce
For example, for the 3 rows in the screenshot (rows 4-6), the correct descending order should be:
Row 4: 2030565120120958979 (largest value)
Row 5: 2030565120120958978
Row 6: 2030565120120958977 (smallest value)
Sample data , DDL and screenshot are shown as follows:
local_message.sql
Additional context
This issue only occurs in Adaptive Ordering mode. If we disable Adaptive Ordering and force a server-side ORDER BY id DESC, the sorting works correctly.
Thanks for your time and help to look into this issue!