Add IF NOT EXISTS support to CREATE VIEW#28302
Add IF NOT EXISTS support to CREATE VIEW#28302abdela47 wants to merge 2 commits intotrinodb:masterfrom
Conversation
|
Thank you for your pull request and welcome to the Trino community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. Continue to work with us on the review and improvements in this PR, and submit the signed CLA to cla@trino.io. Photos, scans, or digitally-signed PDF files are all suitable. Processing may take a few days. The CLA needs to be on file before we merge your changes. For more information, see https://github.com/trinodb/cla |
| return Objects.equals(name, o.name) | ||
| && Objects.equals(query, o.query) | ||
| && replace == o.replace | ||
| && replace == o.replace && notExists == o.notExists |
There was a problem hiding this comment.
Move && notExists == o.notExists to a new line.
| (COMMENT string)? | ||
| (WITH properties)? AS rootQuery #createMaterializedView | ||
| | CREATE (OR REPLACE)? VIEW qualifiedName | ||
| | CREATE (OR REPLACE)? VIEW (IF NOT EXISTS)? qualifiedName |
| getQualifiedName(context.qualifiedName()), | ||
| (Query) visit(context.rootQuery()), | ||
| context.REPLACE() != null, | ||
| context.EXISTS() != null, |
There was a problem hiding this comment.
It seems this PR only updated grammer & parser modules. Please also update trino-main module, and BaseConnectorTest. Also, I recommend updating this option in memory connector.
Description
Add support for
IF NOT EXISTSinCREATE VIEWstatements.This change allows users to safely create a view without failing when the view already exists, improving idempotency and aligning behavior with
CREATE MATERIALIZED VIEW.The update includes:
IF NOT EXISTSCreateViewAdditional context and related issues
This change improves consistency across view creation statements and supports deployment workflows where DDL statements may be executed multiple times.
Examples now supported:
No additional grammar restrictions were introduced, preserving existing parser behavior and maintaining consistency with similar statements.
Fixes #28076
Release notes
(x) Release notes are required, with the following suggested text: