sqlfluff / sqlfluff

A modular SQL linter and auto-formatter with support for multiple dialects and templated code.
https://www.sqlfluff.com
MIT License
7.7k stars 703 forks source link

"create view if not exists v" unparsable (duckdb dialect) #6156

Closed shoffmeister closed 1 week ago

shoffmeister commented 1 week ago

Search before asking

What Happened

Attempted to parse SQL statement below with dialect "duckdb" on https://online.sqlfluff.com/

create view if not exists v as select 1;

Expected Behaviour

Parses exactly the same as

create view v as select 1;

which yields "No problems! Nice job friend." in the online tool.

Observed Behaviour

Error:

Line 1, Position 1: Found unparsable section: 'create view if not exists v as select 1;...'

How to reproduce

echo "create view if not exists v as select 1;" | sqlfluff lint --dialect duckdb -

Dialect

duckdb

Version

sqlfluff, version 3.0.5

Configuration

none

Are you willing to work on and submit a PR to address the issue?

Code of Conduct

shoffmeister commented 1 week ago

The SQL provided works with at least DuckDB 1.0.0 and is documented: https://duckdb.org/docs/sql/statements/create_view