Skip to content

fix(api): db facades accept null parameter values - #6682

Merged
delchev merged 1 commit into
masterfrom
db-null-params
Aug 12, 2026
Merged

fix(api): db facades accept null parameter values#6682
delchev merged 1 commit into
masterfrom
db-null-params

Conversation

@delchev

@delchev delchev commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

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 to Update.execute, and the facade's "primitive array" gate

arr.every(v => typeof v === "string" || typeof v === "number" ||
               typeof v === "boolean" || v instanceof Date || Array.isArray(v))

rejects null, throwing before anything reaches the database — even though the JDBC layer (ParametersSetter.setIndexedParameter) explicitly binds a JSON null element as SQL NULL using the statement's ParameterMetaData type.

Change

  • Accept null / undefined in the primitive-array gate at all four copy-pasted sites (a JS undefined array element serializes to JSON null, which the binder handles identically):
    • db/update.tsUpdate.execute (the Results view edit/create path)
    • db/query.tsQuery.execute
    • db/store.tsStore.query and Store.queryNative
  • Widen the public parameter type unions with | null so 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)}), asserts success: true and verifies the persisted NULL (and that the sibling column kept its updated value) over JDBC.

🤖 Generated with Claude Code

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>
@delchev
delchev merged commit f6b9228 into master Aug 12, 2026
10 checks passed
@delchev
delchev deleted the db-null-params branch August 12, 2026 20:12
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.

db API facades reject null parameter values - Results view row edit fails with 'Unsupported parameter format'

1 participant