Repository navigation
feat(schema): ignore unmodeled statements and report errors in SQL terms - #63
Merged
omer-cengel merged 1 commit intoOct 10, 2026
Merged
Conversation
Only CREATE/ALTER/DROP TABLE, CREATE TYPE ... AS ENUM, and ALTER TYPE ... ADD VALUE change the schema model; every other parsed statement, including views, schemas, session statements, TRUNCATE, policies, roles, domains, and non-enum CREATE TYPE, is now ignored without being resolved against the schema. Statements that may still change the model are rejected with SQL-term messages instead of parser class names: unsupported ALTER TABLE and ALTER TYPE actions, functions or procedures without a dollar-quoted body, and opaque statements that open as table or type DDL, such as ALTER FOREIGN TABLE.
omer-cengel
deleted the
feature/one-rule-for-ignored-schema-statements
branch
October 10, 2026 10:56
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Schema files record a database's whole history, so a fixed list of accepted statements kept stopping real migration histories on views, schemas, session settings, policies, domains, or composite types. sqlcj now applies one rule: only the table and enum statements it models change the schema, and every other parsed statement is accepted without being resolved against the schema. Statements that are still rejected are reported in SQL terms with their line instead of internal parser class names.
Changes
CREATE TABLE,ALTER TABLE,DROP TABLE,CREATE TYPE ... AS ENUM, andALTER TYPE ... ADD VALUEupdate the schema model; every other parsed statement is ignored, includingCREATE/DROP VIEW, materialized views,CREATE/DROP SCHEMA,SET,RESET,TRUNCATE,SELECT, policies, roles, default privileges, domains, procedures, and opaque statements such asALTER FUNCTIONorCREATE CAST.CREATE TYPEis ignored; a column of such a type is recorded with its declared type like any other unmapped type.TRUNCATEof an unmodeled table is accepted.Unsupported ALTER TABLE action at line <n>Unsupported ALTER TYPE action at line <n>Unsupported schema statement: CREATE FUNCTION without a dollar-quoted body at line <n>(orCREATE PROCEDURE)Unsupported schema statement: <opening words> at line <n>for an opaque statement that opens as table or type DDL, such asALTER FOREIGN TABLEDOblocks or function bodies and columns removed byDROP TYPE ... CASCADEare not seen.Scope and non-goals
ALTER TABLEactions other than the modeled forms and the existing constraint actions are still rejected; classifying them is not part of this change.ALTER TYPEactions other thanADD VALUEare still rejected, and enum renames are not modeled.DOblocks andDROP TYPE, remain syntax errors; schema qualifiers,LIKE,PARTITION OF, andAS SELECTtables are unchanged.