directus / directus/directus

Sorting by Name in SQLite3 Database Is Case-Sensitive and Not Working as Expected

Open
#25,443 3 comments 0 reactions 0 assignees View on GitHub
Engine Feature Integrations Low Impact Med Reach SQ lite
Dominant language
TypeScript
Stars
37.9k
Forks
4.9k
Avg merge
3d 21h
Merged PRs (30d)
36

Description

### Describe the Bug

When sorting records by the `name` field in a collection using a SQLite3 database, the results are not ordered as expected. The sorting appears to be case-sensitive, resulting in an order where uppercase and lowercase entries are grouped separately, rather than in a natural alphabetical order. This leads to a confusing user experience, as shown in the attached image.

### To Reproduce

1. Create a new collection in Directus.
2. Add a field named `name` (type: input/text).
3. Insert the following records into the collection:
- `A`
- `a`
- `b`
- `B`
4. Navigate to the display page for the collection.
5. Sort the records by the `name` field.

Image

**Expected Behavior:**
Sorting by name should be case-insensitive, so the records appear in natural alphabetical order: `A`, `a`, `B`, `b` or `a`, `A`, `b`, `B` (depending on collation settings).

### UPDATE:
The numerical sorting isn't correct as well

Image

### Directus Version

v11.9.3

### Hosting Strategy

Self-Hosted (Docker Image)

### Database

sqlite3

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.