Repository navigation
fix: walk the expressions of ALTER TABLE and ALTER DOMAIN actions - #2950
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.
StatementFeatureVisitor.visit(Alter)classifies eachAlterExpressionby itsAlterOperation(the #2894 cases) and then returns without callingsuper, so theDEFAULT,CHECK,USING, generated-column and partition expressions thatStatementVisitorAdapter.visit(Alter)walks throughTableDefinitionTraversalnever reach the pure-function check;visit(AlterDomain)returns before the adapter walks the domain constraint in the same way. PostgreSQL evaluatesALTER COLUMN .. TYPE .. USING, a volatileADD COLUMN .. DEFAULT,ADD CONSTRAINT .. CHECKandALTER DOMAIN .. ADD CONSTRAINT .. CHECKagainst every row already stored while the statement runs, soALTER TABLE t ALTER COLUMN a TYPE int USING purge_audit(a)came back ascertain=[MODIFIES_SCHEMA]withmayModifyData() == falseand no unresolved reference and passed the read-only guard in usage.rst, while the same call inCREATE TABLE x (a INT DEFAULT purge_audit())orSELECT purge_audit()leavesMODIFIES_DATApossible withunresolved=[purge_audit]. I found it while probing which statement positions keep a function out of the purity check, after theSET/DECLARE(#2935) andSHOWfilter (#2947) cases. Both overrides now end withsuper.visit(..)after their classification, the wayvisit(CreateTable)already does; a plainALTER TABLE t ADD COLUMN c INTorRENAMEstill reportscertain=[MODIFIES_SCHEMA]only, and aSET DEFAULTcall is reported as possible like aCREATE TABLEdefault, an over-report on a statement that already modifies the schema. The newalterExpressionIsCheckedcases fail before (4 failures) and pass after;spotlessCheck, Checkstyle, PMD and SpotBugs pass, and the only./gradlew testfailures locally (16672 tests) are the same 33 Mockito inline-mock-maker init errors and 2ParserKeywordsUtilsTestAccessDeniedExceptions as on master, both environment problems on this machine.