Skip to content

feat: record unmapped column types until a query uses them - #43

Merged
omer-cengel merged 2 commits into
masterfrom
feature/record-unmapped-column-types
Sep 27, 2026
Merged

omer-cengel merged 2 commits into
masterfrom
feature/record-unmapped-column-types

Conversation

@omer-cengel

Copy link
Copy Markdown
Member

Summary

A schema that declares a column sqlcj cannot map to Java, such as JSONB,
DOUBLE PRECISION, or any array, no longer fails as a whole. The column is
recorded with its declared type, and only a query that actually uses it fails,
naming the query, the column, and the type, so every other query over the same
table keeps compiling.

Changes

  • Schema parsing records an unmapped or array column with its canonical type
    spelling (upper case, type arguments removed) followed by [] per array
    dimension, for example JSONB, VARCHAR[] for varchar(20)[], and
    INTEGER[][]. Nullability is parsed as before. Array columns were
    previously modeled as their element type; they are now recorded as
    unsupported.
  • Query analysis fails with Column '<name>' has unsupported type <type> when
    a query reads such a column (SELECT or RETURNING item), binds it (a
    placeholder in a comparison, IN list, BETWEEN bound, LIKE/ILIKE
    pattern, INSERT column, or UPDATE assignment), or expands it (SELECT *,
    SELECT qualifier.*, RETURNING *). sqlcj generate reports it as
    Invalid query '<name>' in <file> at line <n>: ... and writes no output.
  • References that do not use the column's type, such as IS NULL or a join
    ON equality, compile, and queries that do not touch the column produce the
    same generated code as before.
  • The PostgreSQL type guide documents the recording and failure rules and the
    new diagnostic.

Scope and non-goals

  • No new Java type mappings: enums, arrays, JSONB, and other unmapped types
    still have no generated Java type.
  • Unsupported schema statements, table constraints, and schema syntax errors
    fail as before.
  • The generator and runtime are unchanged.

@omer-cengel
omer-cengel merged commit 791aca7 into master Sep 27, 2026
6 checks passed
@omer-cengel
omer-cengel deleted the feature/record-unmapped-column-types branch September 27, 2026 12:58
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.

1 participant