fix: enforce C collation for page position ordering to ensure consistent behavior in Postgres 17+ (#1446)

- Add explicit C collation to position ordering queries to fix incorrect page placement in PostgreSQL 17+
- Ensures consistent ASCII-based ordering regardless of database locale settings
- Fixes issue where new pages were incorrectly placed at random positions instead of bottom
This commit is contained in:
Philip Okugbe
2025-08-04 09:49:29 +01:00
committed by GitHub
parent cb2a0398c7
commit 3b85f4b616
2 changed files with 3 additions and 3 deletions

View File

@ -178,7 +178,7 @@ export class ImportService {
.selectFrom('pages')
.select(['id', 'position'])
.where('spaceId', '=', spaceId)
.orderBy('position', 'desc')
.orderBy('position', (ob) => ob.collate('C').desc())
.limit(1)
.where('parentPageId', 'is', null)
.executeTakeFirst();