Skip to content

fix: parse WITH NO SCHEMA BINDING on CREATE VIEW - #2941

Open
harryfoster2006 wants to merge 1 commit into
JSQLParser:masterfrom
harryfoster2006:fix/redshift-no-schema-binding
Open

harryfoster2006 wants to merge 1 commit into
JSQLParser:masterfrom
harryfoster2006:fix/redshift-no-schema-binding

Conversation

@harryfoster2006

Copy link
Copy Markdown
Contributor

Redshift late-binding views end with WITH NO SCHEMA BINDING, so this fails to parse:

CREATE VIEW v AS (SELECT a FROM t) WITH NO SCHEMA BINDING

CreateView only accepted WITH READ ONLY, WITH [CASCADED|LOCAL] CHECK OPTION and WITH [NO] DATA after the query.

Syntax reference: https://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_VIEW.html

Change

  • Grammar: accept WITH NO SCHEMA BINDING after the view query. A two-token lookahead on NO SCHEMA keeps it distinct from WITH NO DATA. BINDING is a contextual keyword, so it is not reserved.
  • CreateView: new withNoSchemaBinding flag with getter, setter and withWithNoSchemaBinding(...), emitted by appendOptionsAfterQueryTo, so both toString() and CreateViewDeParser round-trip it.
  • Test: RedshiftCreateViewTest.lateBindingView covers a parenthesised select, OR REPLACE with a schema-qualified name and column list, and the flag being set.

Redshift late-binding views end with WITH NO SCHEMA BINDING. Accept the
clause after the view query, keep it on CreateView and deparse it.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant