New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Grammar: Adds support for ALTER VIEW statement for Postgres dialect #2096
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
330213d
Grammar: Adds support for ALTER VIEW statement for Postgres dialect
derickl dc1623f
Merge branch 'main' into 2094-postgres-alter-view
derickl 65ddcf6
Merge branch 'main' into 2094-postgres-alter-view
derickl d6c867c
Update src/sqlfluff/dialects/dialect_postgres.py
jpy-git File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
-- issue:2094 | ||
ALTER VIEW myview ALTER date_column SET DEFAULT NOW(); | ||
ALTER VIEW myview ALTER int_column SET DEFAULT 1; | ||
ALTER VIEW myview ALTER text_column SET DEFAULT 'value'; | ||
ALTER VIEW myview ALTER bool_column SET DEFAULT false; | ||
ALTER VIEW myview ALTER other_column SET DEFAULT other_value; | ||
ALTER VIEW myview ALTER other_column SET DEFAULT CURRENT_TIMESTAMP; | ||
ALTER VIEW myview ALTER other_column SET DEFAULT a_function(a_parameter); | ||
ALTER VIEW myview ALTER other_column SET DEFAULT a_function('a_parameter'); | ||
ALTER VIEW myview ALTER other_column DROP DEFAULT; | ||
ALTER VIEW IF EXISTS myview ALTER date_column SET DEFAULT NOW(); | ||
ALTER VIEW IF EXISTS myview ALTER int_column SET DEFAULT 1; | ||
ALTER VIEW IF EXISTS myview ALTER text_column SET DEFAULT 'value'; | ||
ALTER VIEW IF EXISTS myview ALTER bool_column SET DEFAULT false; | ||
ALTER VIEW IF EXISTS myview ALTER other_column SET DEFAULT other_value; | ||
ALTER VIEW IF EXISTS myview ALTER other_column SET DEFAULT CURRENT_TIMESTAMP; | ||
ALTER VIEW IF EXISTS myview ALTER other_column SET DEFAULT a_function(a_parameter); | ||
ALTER VIEW IF EXISTS myview ALTER other_column SET DEFAULT a_function('a_parameter'); | ||
ALTER VIEW IF EXISTS myview ALTER other_column DROP DEFAULT; | ||
|
||
ALTER VIEW myview OWNER TO baz_role; | ||
ALTER VIEW myview OWNER TO "baz-role"; | ||
ALTER VIEW myview OWNER TO CURRENT_ROLE; | ||
ALTER VIEW myview OWNER TO CURRENT_USER; | ||
ALTER VIEW myview OWNER TO SESSION_USER; | ||
ALTER VIEW IF EXISTS myview OWNER TO baz_role; | ||
ALTER VIEW IF EXISTS myview OWNER TO "baz-role"; | ||
ALTER VIEW IF EXISTS myview OWNER TO CURRENT_ROLE; | ||
ALTER VIEW IF EXISTS myview OWNER TO CURRENT_USER; | ||
ALTER VIEW IF EXISTS myview OWNER TO SESSION_USER; | ||
|
||
ALTER VIEW myview RENAME column_name TO new_column_name; | ||
ALTER VIEW myview RENAME COLUMN column_name TO new_column_name; | ||
ALTER VIEW IF EXISTS myview RENAME column_name TO new_column_name; | ||
ALTER VIEW IF EXISTS myview RENAME COLUMN column_name TO new_column_name; | ||
|
||
ALTER VIEW myview RENAME TO new_name; | ||
ALTER VIEW IF EXISTS myview RENAME TO new_name; | ||
|
||
ALTER VIEW myview SET SCHEMA new_schema; | ||
ALTER VIEW IF EXISTS myview SET SCHEMA new_schema; | ||
|
||
ALTER VIEW myview SET ( view_option_name ); | ||
ALTER VIEW myview SET ( view_option_name = 1); | ||
ALTER VIEW myview SET ( view_option_name = 1, view_option_name2 = 'value', view_option_name3, view_option_name4 = false); | ||
ALTER VIEW IF EXISTS myview SET ( view_option_name ); | ||
ALTER VIEW IF EXISTS myview SET ( view_option_name = 1); | ||
ALTER VIEW IF EXISTS myview SET ( view_option_name, view_option_name2 = 1, view_option_name3); | ||
|
||
ALTER VIEW myview RESET ( view_option_name ); | ||
ALTER VIEW myview RESET ( view_option_name, view_option_name2 ); | ||
ALTER VIEW IF EXISTS myview RESET ( view_option_name ); | ||
ALTER VIEW IF EXISTS myview RESET ( view_option_name, view_option_name2 ); |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're correct here. I noticed that the existing AlterTableActionSegment only allows expression segments when it should also account for the segments you have here. If you're interested would you be able to create a separate PR to match that line to the SET DEFAULT grammar you have here and add the corresponding unit tests? 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Raised here: #2101