Repository navigation
PostgreSQL: Support ALTER VIEW operations - #2730
Open
LucaCappelletti94 wants to merge 5 commits into
Open
LucaCappelletti94 wants to merge 5 commits into
LucaCappelletti94 wants to merge 5 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2730 +/- ##
==========================================
+ Coverage 82.61% 82.74% +0.12%
==========================================
Files 42 42
Lines 35614 35725 +111
Branches 35614 35725 +111
==========================================
+ Hits 29421 29559 +138
+ Misses 2659 2641 -18
+ Partials 3534 3525 -9 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
sabir-akhadov-localstack
approved these changes
Oct 27, 2026
| with_options, | ||
| } => { | ||
| if !with_options.is_empty() { | ||
| write!(f, "WITH ({}) ", display_comma_separated(with_options))?; |
Contributor
There was a problem hiding this comment.
Pre-existing, but the parser reads (columns) before WITH (...) while this writes them the other way round, so ALTER VIEW v (a) WITH (x = 1) AS SELECT 1 displays as ALTER VIEW v WITH (x = 1) (a) AS SELECT 1, which doesn't re-parse. Swapping the two blocks here fixes the round-trip.
| } | ||
|
|
||
| #[test] | ||
| fn parse_alter_view_postgres() { |
Contributor
There was a problem hiding this comment.
parse_alter_view has no dialect check, so these could use all_dialects() next to the existing parse_alter_view tests in sqlparser_common.rs.
LucaCappelletti94
force-pushed
the
upstream/postgres-alter-view
branch
from
October 27, 2026 21:03
a408cf1 to
27b559f
Compare
LucaCappelletti94
force-pushed
the
upstream/postgres-alter-view
branch
3 times, most recently
from
October 29, 2026 11:56
2540424 to
65e4595
Compare
sabir-akhadov-localstack
approved these changes
Oct 29, 2026
LucaCappelletti94
force-pushed
the
upstream/postgres-alter-view
branch
2 times, most recently
from
October 30, 2026 08:30
f582bca to
9a84f13
Compare
LucaCappelletti94
force-pushed
the
upstream/postgres-alter-view
branch
3 times, most recently
from
October 30, 2026 17:29
430319b to
4b3e6e5
Compare
LucaCappelletti94
force-pushed
the
upstream/postgres-alter-view
branch
from
October 30, 2026 22:27
4b3e6e5 to
d37a3a7
Compare
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.
ALTER VIEW v OWNER TO oandALTER VIEW v SET (security_invoker = true)fail withExpected: AS, found: OWNER, becauseparse_alter_viewonly knows the MySQL formALTER VIEW v AS SELECT .... The other PostgreSQL forms of the statement fail the same way.Statement::AlterViewnow wraps anAlterViewstruct holdingIF EXISTSand anAlterViewOperation, the shapeAlterCollationalready uses. The MySQL form becomes one variant beside the PostgreSQL ones, which changes the public AST ofStatement::AlterView. PostgreSQL lets aSET (...)option omit its value, so such an option parses toSqlOption::Ident.The syntax follows https://www.postgresql.org/docs/current/sql-alterview.html.
Closes #886.