Skip to content

Conversation

joaostorrer
Copy link
Contributor

Closes #6351.

Brief summary of the change made

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.

Copy link
Contributor

github-actions bot commented Jan 4, 2025

Coverage Results ✅

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

248 files skipped due to complete coverage.

"POINT",
Sequence(
OneOf(*_geometry_type_keywords, "GEOMETRY", "GEOGRAPHY"),
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.

I am by no means an expert on postgis, but it might make more sense to make the comma and numeric literal (the SRID) an optional sequence instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed to be an optional sequence.

Comment on lines 1504 to 1513
OneOf(
"POINT",
Sequence(
OneOf(*_geometry_type_keywords, "GEOMETRY", "GEOGRAPHY"),
Sequence(
Ref("CommaSegment"),
Ref("NumericLiteralSegment"),
optional=True,
),
),
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this can be further simplified because POINT is in the _geometry_type_keywords

Suggested change
OneOf(
"POINT",
Sequence(
OneOf(*_geometry_type_keywords, "GEOMETRY", "GEOGRAPHY"),
Sequence(
Ref("CommaSegment"),
Ref("NumericLiteralSegment"),
optional=True,
),
),
Sequence(
OneOf(*_geometry_type_keywords, "GEOMETRY", "GEOGRAPHY"),
Sequence(
Ref("CommaSegment"),
Ref("NumericLiteralSegment"),
optional=True,
),
),

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My bad. I refactored now.

Copy link
Contributor

@keraion keraion left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for taking care of this!

@keraion keraion added this pull request to the merge queue Feb 5, 2025
Merged via the queue into sqlfluff:main with commit 97ac755 Feb 5, 2025
29 checks passed
@joaostorrer joaostorrer deleted the postgres_geometry_function branch February 6, 2025 18:29
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.

[Postgres] geometry/geography subtypes in function arguments fail to parse
3 participants