Skip to content

subset__where` Comparison Operators Fail With "Could not select an operator overload" #3623

@ibarakaiev

Description

@ibarakaiev

Description

When using subset__where with any comparison operator (=, <>, !=, LIKE, IN), Electric returns an error.

Note: This is the format that TanStack DB uses to assemble subset queries, so this should be supported.

Error:

{
  "message": "Invalid request",
  "errors": {
    "subset": {
      "where": ["At location X: Could not select an operator overload"]
    }
  }
}

The parser appears unable to resolve operator overloads for comparison operations, even with explicit type casts.

Environment

  • Electric version: 1.2.9 (also tested with latest)
  • PostgreSQL: TimescaleDB (pg17)

Reproduction

Schema

CREATE TABLE users (
  id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
  email TEXT NOT NULL UNIQUE,
  activated BOOLEAN NOT NULL DEFAULT false
);

INSERT INTO users (email, activated) VALUES ('[email protected]', true);

Requests That FAIL

All of these return the "Could not select an operator overload" error:

# Equality with string literal
curl "http://localhost:5433/v1/shape?table=users&offset=-1&subset__where=email='[email protected]'"
# {"message":"Invalid request","errors":{"subset":{"where":["At location 5: Could not select an operator overload"]}}}

# Inequality
curl "http://localhost:5433/v1/shape?table=users&offset=-1&subset__where=email<>'[email protected]'"
# {"message":"Invalid request","errors":{"subset":{"where":["At location 5: Could not select an operator overload"]}}}

# Numeric comparison
curl "http://localhost:5433/v1/shape?table=users&offset=-1&subset__where=id=1"
# {"message":"Invalid request","errors":{"subset":{"where":["At location 2: Could not select an operator overload"]}}}

# LIKE operator (URL encoded)
curl "http://localhost:5433/v1/shape?table=users&offset=-1&subset__where=email%20LIKE%20'test%25'"
# {"message":"Invalid request","errors":{"subset":{"where":["At location 6: Could not select an operator overload"]}}}

Requests That WORK

# Boolean literal
curl "http://localhost:5433/v1/shape?table=users&offset=-1&subset__where=true"
# Returns data successfully

# IS NOT NULL
curl "http://localhost:5433/v1/shape?table=users&offset=-1&subset__where=email%20IS%20NOT%20NULL"
# Returns data successfully

# Boolean column comparison
curl "http://localhost:5433/v1/shape?table=users&offset=-1&subset__where=activated=true"
# Returns data successfully

Expected Behavior

Comparison operators (=, <>, LIKE, IN, etc.) should work in subset__where clauses, allowing filtering like:

subset__where=email='[email protected]'
subset__where=email<>$1&subset__params={"1":"[email protected]"}

Analysis

The error "Could not select an operator overload" suggests the parser cannot determine which operator implementation to use.

Pattern observed:

  • Boolean comparisons work (activated=true, true)
  • IS NOT NULL works
  • Text/string comparisons fail (email='...', email<>'...', LIKE)
  • Numeric comparisons fail (id=1)

The parser appears to handle boolean types correctly but cannot resolve operator overloads for text or numeric types. This may indicate that the parser is not fetching table schema information to determine column types when selecting operator overloads for non-boolean columns.


This issue was written with the assistance of Claude Code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions