When using @prisma/adapter-mariadb (driver adapter), a findMany with a compound cursor containing a DateTime field returns 0 rows. The equivalent WHERE-based query returns the correct results.
bun install
bunx prisma generate
bunx prisma db push --url "mysql://root@127.0.0.1:3306/cursor_repro"
bun repro.tsUpdate the connection details in repro.ts and the --url flag for your MySQL instance.
Seeded 10 rows for appId=1
Cursor row: { appId: 1, createdAt: 2025-01-03T00:00:00.000Z }
--- Test 1: Compound cursor with DateTime (via adapter) ---
Result: 0 rows (expected: 3)
--- Test 2: WHERE-based equivalent (works) ---
Result: 3 rows (expected: 3)
Rows: [ '2025-01-04', '2025-01-05', '2025-01-06' ]
- Prisma 7.4.2
@prisma/adapter-mariadb7.4.2- MySQL 8.0
- macOS, bun 1.x
- Both
Dateobjects and ISO strings fail as cursor values. - The cursor subquery reaches the database but the DateTime comparison silently returns no matches.
- The generated SQL uses a subquery for cursor positioning that fails with DateTime values.