Skip to content

test(compiler): run reference service query shapes and rejections - #78

Merged
omer-cengel merged 1 commit into
masterfrom
chore/reference-service-query-shapes-and-unsupported-catalogue
Oct 11, 2026
Merged

omer-cengel merged 1 commit into
masterfrom
chore/reference-service-query-shapes-and-unsupported-catalogue

Conversation

@omer-cengel

Copy link
Copy Markdown
Member

Summary

Extends the reference service so the query shapes sqlcj now accepts run against PostgreSQL 16 through the generated repository, and so every shape that stays unsupported is pinned to its exact located diagnostic. No production code changes.

Changes

  • Adds an eleventh reference migration, mirrored in the hand-written snapshot: a nullable tasks.assignee_id referencing users with ON DELETE SET NULL, a users.deleted_at soft-delete column, and a partial unique index on (organization_id, handle) WHERE deleted_at IS NULL. The migration history, the snapshot, and the pg_dump snapshot still generate one byte-identical, compiling tree.
  • Adds eleven reference queries and a runtime test that executes them in their own organization:
    • a dynamic ORDER BY CASE sort in both modes and a cast LIMIT/OFFSET page;
    • EXISTS, IN (SELECT ...), and scalar-subquery queries with cast placeholders;
    • a composite-key join that reads the membership role;
    • a filtered left join that names only a live assignee;
    • an untargeted ON CONFLICT DO NOTHING, and an ON CONFLICT ON CONSTRAINT ... DO UPDATE ... WHERE that skips an unchanged role;
    • a conflict-target predicate over the partial index;
    • an optimistic update with an aliased RETURNING.
  • Adds an unsupported query catalogue, one file per shape: set operations, RIGHT, FULL, USING, NATURAL, CROSS, comma, and LATERAL joins, a CTE source, a FROM subquery, multi-row VALUES, INSERT ... SELECT, UPDATE ... FROM, DELETE ... USING, an uncast lower(:email), and an uncast placeholder beside a subscripted column. Each entry is asserted with its whole located diagnostic and no generated output, and the catalogue directory is asserted to hold exactly those files.
  • Lists the new tests in the Verified by sections of the query and PostgreSQL documentation.

Scope and non-goals

  • Test fixtures, tests, and documentation lines only; analyzer, generator, runtime, CLI, and configuration behavior are unchanged.
  • No new query shapes are supported; the catalogue records shapes that remain rejected, including nested queries and multi-row or joined writes.
  • All fixture SQL is original to sqlcj.

Add an eleventh reference migration with a task assignee, a soft-deleted
user column, and a partial unique handle index, mirrored in the snapshot,
and eleven queries that run through the generated repository against
PostgreSQL 16: a dynamic sort and cast page, EXISTS, IN (SELECT ...), and
scalar subqueries, composite-key and filtered left joins, untargeted,
named-constraint, and predicated conflict clauses, DO UPDATE ... WHERE,
and an aliased RETURNING.

Add an unsupported query catalogue with one file per rejected shape, each
asserted with its whole located diagnostic and no generated output, and
list the new tests in the query and PostgreSQL documentation.
@omer-cengel
omer-cengel merged commit 3f7c0fa into master Oct 11, 2026
7 checks passed
@omer-cengel
omer-cengel deleted the chore/reference-service-query-shapes-and-unsupported-catalogue branch October 11, 2026 21:43
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