Skip to content

Conversation

nspcc-cm
Copy link
Contributor

@nspcc-cm nspcc-cm commented Oct 3, 2024

  1. "RETURNS NULL ON NULL INPUT" option would fail because "INPUT" was not an unreserved keyword
  2. function option segment wouldn't allow multiple comma delimited items
  3. "AS", before "BEGIN" was not considered optional

Brief summary of the change made

This PR fixes a number of issues with CREATE FUNCTION syntax in TSQL.

The following issues has been resolved:

  1. "RETURNS NULL ON NULL INPUT" option would fail because "INPUT" was not an unreserved keyword
  2. function option segment wouldn't allow multiple comma delimited items
  3. "AS", before "BEGIN" was not considered optional

Fixed in the following ways:

  1. "INPUT" added to tsql unreserved keywords list
  2. Delimited() added to FunctionOptionSegment
  3. OnOf("AS", optional=True) added to CreateFunction

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

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.

nspcc-cm and others added 3 commits October 3, 2024 16:27
1. "RETURNS NULL ON NULL INPUT" option would fail because "INPUT" was not an unreserved keyword
2. function option segment wouldn't allow multiple comma delimited items
3. "AS", before "BEGIN" was not considered optional
Copy link
Contributor

github-actions bot commented Oct 4, 2024

Coverage Results ✅

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

236 files skipped due to complete coverage.

Copy link
Contributor

@greg-finley greg-finley left a comment

Choose a reason for hiding this comment

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

good start, one small nit

Copy link
Contributor

@greg-finley greg-finley left a comment

Choose a reason for hiding this comment

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

Awesome, thank you!

@greg-finley greg-finley enabled auto-merge October 7, 2024 14:03
@greg-finley greg-finley added this pull request to the merge queue Oct 7, 2024
Merged via the queue into sqlfluff:main with commit 73823d4 Oct 7, 2024
27 checks passed
@nspcc-cm nspcc-cm deleted the fix_tsql_delimited_function_option_segment branch October 7, 2024 14:35
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.

3 participants