Repository navigation
fix: report a feature for every statement in StatementValidator - #2886
Open
tanjiroK-coder wants to merge 1 commit into
Open
tanjiroK-coder wants to merge 1 commit into
tanjiroK-coder wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
Validationonly rejects what a validator reports as aFeature, and 34 statement types inStatementValidatorreport none, so they pass everyFeaturesAllowedand database check. COPY, ATTACH/DETACH, CONNECT/DISCONNECT, PRAGMA, INSTALL/LOAD, CREATE MACRO, CREATE EXTENSION REPOSITORY, EXPORT DATA, LOAD DATA, ASSERT, PREPARE/DEALLOCATE, SAVEPOINT, LOCK, ALTER SESSION, ALTER SYSTEM, PURGE, RENAME TABLE and the Exasol IMPORT/EXPORT are still// TODO: not yet implemented, CREATE USER and SESSION return straight away, CREATE/ALTER POLICY and CREATE STATISTICS only walk their children, ROLLBACK only checksAND CHAIN, ALTER STATISTICS andALTER ... ALL IN TABLESPACEhave no override, CREATE EVENT, ALTER EVENT and body-style CREATE TRIGGER only check their body, and anUnsupportedStatement(which the parser now also returns for unmodelled CREATE forms such asCREATE LANGUAGE plperlu) is accepted as is. WithFeaturesAllowed.SELECTused as a read-only gate,ALTER SYSTEM SET archive_command = '...',COPY t TO '/tmp/x',ATTACH DATABASE '/tmp/x.db' AS x,CREATE USER 'app'@'%' REQUIRE SSLandCREATE EVENT e ON SCHEDULE EVERY 1 DAY DO SELECT 1all validate without errors. I found them by running the SQL literals of the test suite through validation with an emptyFeaturesAllowedand listing the statement types that still came back clean; after this change none does. Each statement now reports its own feature: a new constant where none existed,alterTablefor RENAME TABLE,alterTablespaceforALTER ... ALL IN TABLESPACE,exportfor EXPORT DATA, the so far unusedimprtandexportfor Exasol, andallowUnsupportedStatementsfor anUnsupportedStatement, whose tokens cannot be checked. The new features are added to the database versions whose syntax has the statement, and the policy, statistics and event ones toFeaturesAllowed.CREATEandALTER, so valid dialect SQL keeps validating (DdlVisitorTraversalTestexpects ALTER POLICY and CREATE STATISTICS to pass under DDL); touchingH2Versionmakes the spotless ratchet reformat the rest of that file. The newStatementValidatorTestcases check every statement againstFeaturesAllowed.SELECTand against the databases that support it, and./gradlew checkandmvn verifypass.