Skip to content

feat: state unsupported queries in SQL terms and flag internal errors - #76

Merged
omer-cengel merged 2 commits into
masterfrom
feature/unsupported-query-diagnostics-and-internal-errors
Oct 11, 2026
Merged

omer-cengel merged 2 commits into
masterfrom
feature/unsupported-query-diagnostics-and-internal-errors

Conversation

@omer-cengel

Copy link
Copy Markdown
Member

Summary

Queries outside the supported subset used to fail with raw parser class names or cast-failure messages, and an unexpected failure inside sqlcj passed its exception message straight to the user. Every unsupported query now fails with one located diagnostic that names the construct in SQL terms and, where one exists, what to write instead. Any failure that is not one of sqlcj's own diagnostics is reported as a located internal-error line that asks for a defect report.

Changes

  • UNION, INTERSECT, and EXCEPT, written directly or in parentheses, are rejected with a suggestion to write one query per SELECT. Every statement other than SELECT, INSERT, UPDATE, and DELETE, including VALUES and TABLE statements, is rejected naming the supported kinds, before the annotation is checked.
  • A parenthesized SELECT is analyzed as the query it encloses, at any depth.
  • A computed projection is rejected naming the expression as written and suggesting a cast with an alias. A computed RETURNING item is rejected naming the expression and the items that are supported.
  • A LATERAL source, a subquery in FROM, and a source that names a WITH clause of its own query are each rejected with their own diagnostic, so a CTE named like a table never reads that table.
  • FULL, RIGHT, CROSS, NATURAL, USING, and comma-separated joins each get their own diagnostic, and those that can be rewritten say how.
  • INSERT ... SELECT, with or without parentheses, is rejected on every insert. A parenthesized single VALUES row still analyzes as before. UPDATE ... FROM, comma-joined UPDATE, DELETE ... USING, and joined DELETE are rejected on every write, not only when the write returns rows.
  • The compiler treats only its own parse, schema, configuration, and compilation exceptions, plus unsupported-operation and illegal-argument exceptions with a message, as diagnostics. Any other failure in schema parsing, query analysis, repository generation, or shared row and enum generation becomes one line that names the schema file, query, query group, or package and ends ; please report this sqlcj defect, without the failure's message or class.
  • The compiler gains a package-private constructor so tests can inject a failure at each step.
  • The query documentation lists each diagnostic, the rejected forms, and the tests that verify them.

Scope and non-goals

  • Subqueries, common table expressions used as sources, multi-row VALUES, INSERT ... SELECT, and joined writes are still unsupported. Only how they are reported changes.
  • No supported query changes its parameters, binding order, result columns, or executable SQL.
  • Diagnostics keep their existing location (query source, query name, and header line). Positions within a query are not added.

Set operations, other statement kinds, computed projections and RETURNING
items, LATERAL, subquery and CTE-named sources, unsupported join kinds,
INSERT ... SELECT, and joined or multi-table writes on every write now fail
with a diagnostic that names the construct and, where one exists, what to
write instead. A parenthesized SELECT is analyzed as the query it encloses,
and a parenthesized single VALUES row still analyzes as before.
A failure that is not one of sqlcj's own diagnostics is reported as one
located line that names the schema file, query, query group, or package
and asks for a defect report, without the failure's message or class.
@omer-cengel
omer-cengel merged commit 8919f88 into master Oct 11, 2026
7 checks passed
@omer-cengel
omer-cengel deleted the feature/unsupported-query-diagnostics-and-internal-errors branch October 11, 2026 18:18
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