Skip to content

Conversation

nathanthorell
Copy link
Contributor

@nathanthorell nathanthorell commented Jan 22, 2025

Brief summary of the change made

fixes #5831

Two main things in #5831 were throwing unparsable errors. There was a binary column with a default value supplied in hexadecimal notation going in as a DEFAULT CONSTRAINT, and there was an ALTER TABLE DROP COLUMN statement that listed multiple columns.

UPDATE: The DROP COLUMN for multiple columns was fixed in #6501 (which I hadn't noticed with my first commit). I'm adding some additional test coverage to account for that scenario.

Are there any other side effects of this change that we should be aware of?

None

Pull Request checklist

  • Please confirm you have completed any of the necessary steps below.

  • Included test cases to demonstrate any code changes, which may be one or more of the following:

    • .yml rule test cases in test/fixtures/rules/std_rule_cases.
    • .sql/.yml parser test cases in test/fixtures/dialects (note YML files can be auto generated with tox -e generate-fixture-yml).
    • Full autofix test cases in test/fixtures/linter/autofix.
    • Other.
  • Added appropriate documentation for the change.

  • Created GitHub issues for any relevant followup/future enhancements if appropriate.

Copy link
Contributor

github-actions bot commented Jan 22, 2025

Coverage Results ✅

Name    Stmts   Miss  Cover   Missing
-------------------------------------
TOTAL   19263      0   100%

248 files skipped due to complete coverage.

@nathanthorell nathanthorell changed the title TSQL: fixs for multi column drop and hex default constraint TSQL: fixes for multi column drop and hex default constraint Jan 22, 2025
Delimited(Ref("ColumnReferenceSegment")),
Ref("ColumnReferenceSegment"),
Sequence(
Ref("CommaSegment"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change doesn't make sense to me, this is just the unpacking of the Delimited functionality?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I split it because I needed a way to show that the "Comma + more columns" section was optional, but that the initial single column reference is required during a DROP COLUMN statement.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delimited() has this behaviour by default, it includes lists of length 1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I understand now. I was basing it off of this not working in 3.3.0, but that release was on Dec 10th, and now I see that a PR was merged into main on Dec 11th that fixed this specific section. But I hadn't noticed that and didnt see this Issue tagged to that PR so I thought this was still an open problem. I will remove this part of my PR leaving only the hex default constraint change.

Copy link
Contributor

@WittierDinosaur WittierDinosaur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge conflicts on a couple of files now

@nathanthorell nathanthorell changed the title TSQL: fixes for multi column drop and hex default constraint TSQL: fix for hex default constraint Jan 25, 2025
Copy link
Contributor

@WittierDinosaur WittierDinosaur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@WittierDinosaur WittierDinosaur added this pull request to the merge queue Jan 25, 2025
Merged via the queue into sqlfluff:main with commit ed945f8 Jan 25, 2025
29 checks passed
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.

Fails to format tsql code scenario
2 participants