Skip to content
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

Drop type support #1911

Closed
Langes01x opened this issue Nov 15, 2021 · 1 comment · Fixed by #1919
Closed

Drop type support #1911

Langes01x opened this issue Nov 15, 2021 · 1 comment · Fixed by #1919
Labels
ansi Relating to ANSI SQL or commonly used SQL even if not officially part of ANSI standard bug Something isn't working

Comments

@Langes01x
Copy link

Expected Behaviour

SQLFluff using T-SQL (or ANSI) dialect should be able to parse a create type statement. Create type is defined in ANSI but drop type isn't.

Refer to T-SQL syntax here: https://docs.microsoft.com/en-us/sql/t-sql/statements/drop-type-transact-sql?view=sql-server-ver15

Observed Behaviour

SQLFluff fails to parse the statement

Steps to Reproduce

echo drop type typeName| sqlfluff parse -

[L:  1, P:  1]      |file:
[L:  1, P:  1]      |    unparsable:                                               !! Expected: 'FileSegment'
[L:  1, P:  1]      |        raw:                                                  'drop'
[L:  1, P:  5]      |        whitespace:                                           ' '
[L:  1, P:  6]      |        raw:                                                  'type'
[L:  1, P: 10]      |        whitespace:                                           ' '
[L:  1, P: 11]      |        raw:                                                  'typeName'
[L:  1, P: 19]      |    newline:                                                  '\n'

==== parsing violations ====
L:   1 | P:   1 |  PRS | Line 1, Position 1: Found unparsable section: 'drop type typeName'

Dialect

T-SQL (but also ANSI and maybe others too)

Version

SQLFluff - 0.8.1
Python - 3.10.0

Configuration

# Refer to https://docs.sqlfluff.com/en/stable/configuration.html#default-configuration for defaults
[sqlfluff]
dialect = tsql
templater = raw
sql_file_exts = .sql

[sqlfluff:rules]
allow_scalar = False
single_table_references = qualified

[sqlfluff:rules:L007]  # Operator location
operator_new_lines = before

[sqlfluff:rules:L010]  # Keyword capitalization
capitalisation_policy = upper

[sqlfluff:rules:L014]  # Identifier capitalization
extended_capitalisation_policy = pascal

[sqlfluff:rules:L030]  # Function capitalization
capitalisation_policy = lower

[sqlfluff:rules:L040]  # Null & Boolean capitalization
capitalisation_policy = lower

[sqlfluff:rules:L042]  # Subqueries
forbid_subquery_in = both

[sqlfluff:rules:L047]  # Count syntax
prefer_count_1 = True
prefer_count_0 = False
@Langes01x Langes01x added the bug Something isn't working label Nov 15, 2021
@WittierDinosaur WittierDinosaur added the ansi Relating to ANSI SQL or commonly used SQL even if not officially part of ANSI standard label Nov 16, 2021
@jpy-git
Copy link
Contributor

jpy-git commented Nov 17, 2021

Will add this now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ansi Relating to ANSI SQL or commonly used SQL even if not officially part of ANSI standard bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants