Skip to content

Alter statement is not parsable #5766

@olshak

Description

@olshak

Search before asking

  • I searched the issues and found no similar issues.

What Happened

When running sqlfluff on the following alter statement:
ALTER TABLE tsADD COLUMNmodified_at timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP;
I get the following error:
Found unparsable section: 'ON UPDATE CURRENT_TIMESTAMP'

Expected Behaviour

Parser should correctly parse the statement.

Observed Behaviour

Parsing fails.

How to reproduce

Run:
sqlfluff lint -d mysql update.sql
Where update.sql contains:
ALTER TABLE tsADD COLUMNmodified_at timestamp NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP;

Dialect

MySQL

Version

sqlfluff, version 3.0.3

Configuration

[sqlfluff]
dialect = tsql
max_line_length = 120
large_file_skip_byte_limit = 0
rules = ambiguous.join,
aliasing.table,
layout.select_modifiers,
capitalisation.keywords,
capitalisation.functions,
ics

[sqlfluff:indentation]
indent_unit = tab
indented_then = False
indented_then_contents = False
indented_joins = True

[sqlfluff:rules:capitalisation.keywords]
capitalisation_policy = lower

[sqlfluff:rules:capitalisation.functions]
capitalisation_policy = lower

[sqlfluff:layout:type:comma]
spacing_after = any
line_position = any

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

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions