fix(api): db facades accept null parameter values - #6682
Merged
Conversation
The primitive-array gate in the db TS facades rejected null with 'Unsupported parameter format', so the Database perspective's Results view could not save an edited row whenever any column carried NULL - even though ParametersSetter binds a JSON null element as SQL NULL via the statement's ParameterMetaData type. Accept null/undefined in the gate at all four copy-pasted sites (Update.execute, Query.execute, Store.query, Store.queryNative) and widen the public parameter type unions with '| null'. DatabaseCrudNullValuesIT drives the same Results-view CRUD endpoint: verified red against the unfixed module (the exact reported error) and green with the fix, persisted NULL checked over JDBC. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Fixes #6680.
Problem
Editing a row in the Database perspective's Results view failed with
Unsupported parameter format: [...]whenever any column carried NULL (or a field was cleared to NULL). The Results view's CRUD service passes a plain value array toUpdate.execute, and the facade's "primitive array" gaterejects
null, throwing before anything reaches the database — even though the JDBC layer (ParametersSetter.setIndexedParameter) explicitly binds a JSONnullelement as SQL NULL using the statement'sParameterMetaDatatype.Change
null/undefinedin the primitive-array gate at all four copy-pasted sites (a JSundefinedarray element serializes to JSONnull, which the binder handles identically):db/update.ts—Update.execute(the Results view edit/create path)db/query.ts—Query.executedb/store.ts—Store.queryandStore.queryNative| nullso TypeScript callers can pass nulls without casts.No Java changes; no behavior change for currently-working calls.
Test
DatabaseCrudNullValuesIT(HTTP-only, untagged → runs in the PR smoke leg): creates a table with nullable columns via JDBC (quoted identifiers so both H2 and PostgreSQL keep exact case), seeds a row, updates it to NULL through the same Results-view CRUD endpoint (PUT /services/js/view-databases/js/databaseTable.js/{ds}/{schema}/{base64(table)}), assertssuccess: trueand verifies the persisted NULL (and that the sibling column kept its updated value) over JDBC.🤖 Generated with Claude Code