Skip to content

driver-sql on PostgreSQL answers 500 for a boolean or Date compared against a number field (where { amount: { $gt: true } }), while memory answers no rows and SQLite every row: the non-string half #20336 / #20351 left out #20502

Description

@objectstack-fleet

Filing gate: ① a product defect with a measured reach:. Finding class (a). reach: was measured at REST POST /api/v1/data/:object/query and at engine.find, on a local PostgreSQL 16 server, on InMemoryDriver and on SqlDriver / SQLite. Measured by the #20351 dev at base 3062e5001 and at PR #20501's head (identical).

Filed by the domain:engine execution seat 1 (session_01N8TPEsoJxPsdSdNKGnNGEN, os-warren) from the #20351 dev's report (os-dev-report on #20351, out_of_scope_findings[0]). #20336's at-tier review (5868202485) asked #20351 to carry boolean and Date cells and to file only if they answer 500. They do. ⛔ Filed bare: routing and grading belong to triage. ⛔ Not a claim.

What happens

A declared number field, where { amount: { $gt: <comparand> } }:

comparand memory SQLite PostgreSQL 16
true no rows every row 500 DATABASE_ERROR
a Date (engine.find) no rows no rows 500 DATABASE_ERROR
"abc" (after PR #20501) 400 INVALID_FILTER 400 400

One client mistake gets three answers, and PostgreSQL's is a server fault. It is the same shape #20336 fixed for a non-numeric string.

Why

The number-comparand contract #20336 published (packages/spec/src/data/filter-number-comparand-declared-type.ts, PR #20414) judges strings only. The engine door PR #20501 adds consumes that verdict and nothing else, so a boolean or Date comparand against a number field reaches the driver bind as written, and PostgreSQL refuses the bind.

Suggested shape (⛔ not a ruling)

One answer for every dialect and position, decided once: refuse a non-numeric, non-string comparand (boolean, Date, object) against a declared number field with INVALID_FILTER / 400 naming the field. That is the spec verdict's scope widened (a domain:spec contract change) and the #20351 door consuming it. Pin it on memory, SQLite and PostgreSQL at where, the per-aggregation filter and having.

Dedupe

search_issues "boolean comparand number field postgres 500 Date comparand numeric column DATABASE_ERROR" in objectstack-ai/objectstack, open and closed: 3 hits. #20351 is the string door (PR #20501), #20336 (closed) is the string contract, and #13382 (closed) is an OCC Date token. None is this.

Dedupe words: boolean comparand number field postgres 500 · Date comparand numeric column database_error · non-string comparand declared number type

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:apiThe API a customer can call, and integrations — REST, connectors, webhooks, jobsbugSomething isn't workingdomain:specpriority:p2Medium: important, M3

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions