Skip to content

fix(kysely-adapter): followup#33

Merged
olliethedev merged 1 commit intomainfrom
fix/null-eq-adapter-bug
Mar 18, 2026
Merged

fix(kysely-adapter): followup#33
olliethedev merged 1 commit intomainfrom
fix/null-eq-adapter-bug

Conversation

@olliethedev
Copy link
Collaborator

@olliethedev olliethedev commented Mar 17, 2026

Note

Medium Risk
Touches MySQL-specific create/update return-path logic in the Kysely adapter; incorrect handling could cause missing/incorrect records to be returned after writes, especially when NULL is involved.

Overview
Fixes the Kysely adapter’s MySQL withReturning re-fetch logic to correctly handle falsy values and NULL in the lookup key. It now prefers values[field] when it is explicitly present (not just truthy) and uses IS NULL instead of = NULL when re-selecting rows.

Adds an e2e regression test ensuring adapter.update returns the updated record when the where clause includes an eq null condition.

Written by Cursor Bugbot for commit 6a103a8. This will update automatically on new commits. Configure here.

…s null

After an UPDATE on MySQL, kysely re-fetches the row because MySQL does not
support RETURNING. The re-fetch was using a hard-coded "=" operator, so
queries with a null where-clause value generated "field = null" (always
zero rows). Use "is" null check instead, mirroring the fix already applied
to the findMany/findOne where-clause conversion.

Also fixes the value lookup to use `!== undefined` so falsy-but-valid
values (0, false, "") are no longer silently skipped.

Adds a regression test covering update() with a null value in the WHERE
condition.

Made-with: Cursor
@olliethedev olliethedev merged commit 95ff779 into main Mar 18, 2026
19 checks passed
@olliethedev olliethedev deleted the fix/null-eq-adapter-bug branch March 18, 2026 00:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant