Merged
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
Medium Risk
Touches MySQL-specific
create/updatereturn-path logic in the Kysely adapter; incorrect handling could cause missing/incorrect records to be returned after writes, especially whenNULLis involved.Overview
Fixes the Kysely adapter’s MySQL
withReturningre-fetch logic to correctly handle falsy values andNULLin the lookup key. It now prefersvalues[field]when it is explicitly present (not just truthy) and usesIS NULLinstead of= NULLwhen re-selecting rows.Adds an e2e regression test ensuring
adapter.updatereturns the updated record when thewhereclause includes aneq nullcondition.Written by Cursor Bugbot for commit 6a103a8. This will update automatically on new commits. Configure here.