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

Modifier support for Custom Datatype #680

Merged
merged 5 commits into from Oct 20, 2022

Conversation

sunng87
Copy link
Contributor

@sunng87 sunng87 commented Oct 20, 2022

In PostgreSQL/PostGIS, when creating tables with geometry or geography data type, additional modifiers are allowed. In this example, we can specify geography(POINT, 4269) as data type, which indicates the column is geography point typed, and uses 4269 as its spatial reference system.

Back to sqlparser, at the moment we don't support Custom data type that comes with additional modifiers/arguments in form of (..). This patch add support for that. Since these data can be in any form like an identifier, a number or a string, here I convert all of them into String. Suggestions are welcomed.

Edit: In PostGIS this is called type modifiers.

@sunng87 sunng87 changed the title Arguments support for Custom Datatype Modifier support for Custom Datatype Oct 20, 2022
Copy link
Collaborator

@alamb alamb 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 @sunng87

@coveralls
Copy link

Pull Request Test Coverage Report for Build 3286510718

  • 26 of 28 (92.86%) changed or added relevant lines in 2 files are covered.
  • 8 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.04%) to 85.949%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/parser.rs 22 24 91.67%
Files with Coverage Reduction New Missed Lines %
src/parser.rs 8 83.66%
Totals Coverage Status
Change from base Build 3285178552: 0.04%
Covered Lines: 10900
Relevant Lines: 12682

💛 - Coveralls

@alamb alamb merged commit 914810d into sqlparser-rs:main Oct 20, 2022
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.

None yet

3 participants