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

Distinguish between CHAR VARYING, CHARACTER VARYING, and CHARACTER data types, differentiating them from VARCHAR and CHAR #648

Merged
merged 1 commit into from Oct 4, 2022

Conversation

AugustoFKL
Copy link
Contributor

Adding support for CHAR VARYING, CHARACTER VARYING, and CHARACTER data types, differentiating them from VARCHAR and CHAR, which were mistakenly considered the same (1).

The precision is optional to support PostgreSQL's syntax (2).

Also, adding tests to start resolving #2, but that's a WIP.

[1] : https://jakewheat.github.io/sql-overview/sql-2016-foundation-grammar.html#character-string-type
[2] : https://www.postgresql.org/docs/current/datatype-character.html
Resolves: #647

@AugustoFKL
Copy link
Contributor Author

@alamb ready for review :D

@coveralls
Copy link

coveralls commented Oct 2, 2022

Pull Request Test Coverage Report for Build 3178311617

  • 35 of 37 (94.59%) changed or added relevant lines in 3 files are covered.
  • 3 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.008%) to 85.636%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/parser.rs 26 28 92.86%
Files with Coverage Reduction New Missed Lines %
src/ast/data_type.rs 1 88.04%
src/parser.rs 2 83.11%
Totals Coverage Status
Change from base Build 3174416715: -0.008%
Covered Lines: 10266
Relevant Lines: 11988

💛 - Coveralls

alamb
alamb previously approved these changes Oct 3, 2022
@alamb
Copy link
Collaborator

alamb commented Oct 3, 2022

Thank you @AugustoFKL

@alamb
Copy link
Collaborator

alamb commented Oct 3, 2022

This PR appears to have a conflict -- can you please resolve that @AugustoFKL ?

@alamb alamb changed the title 647 Adding all ansii character string types Distinguish between CHAR VARYING, CHARACTER VARYING, and CHARACTER data types, differentiating them from VARCHAR and CHAR Oct 3, 2022
@AugustoFKL
Copy link
Contributor Author

@alamb done :)

About the coverage, I'll add tests as I expand the ANSII data types. Once I finish all of them (I plan to do that this week), I'll add tests to cover additional data types that aren't on ANSII (e.g., DOUBLE)

@@ -5288,80 +5295,46 @@ mod tests {
});
}

// TODO add tests for all data types? https://github.com/sqlparser-rs/sqlparser-rs/issues/2
// TODO when we have dialect validation by data type parsing, split test
#[test]
Copy link
Collaborator

Choose a reason for hiding this comment

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

seems like we have lost coverage after the rebase (e.g. the new tests for TIME WITHOUT TIMEZONE for example)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@alamb that's expected, as I mentioned in my comment above.

I'll add tests along the week, trying to reach 100% coverage for data type parsing. But for now, I'd like to restrict this to the ones I added if possible

Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't understand why this PR would remove coverage for types that were added in other PRs. I am fine with expanding coverage in future PRs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair enough. It was because I (dumbly) did the structure for tests twice, as it didn't please me. I'll re-add the coverage for those data types, and for now leave as "additional data types" for those that aren't covered by ANSII

@alamb alamb dismissed their stale review October 3, 2022 16:11

potentia rebase problem

@AugustoFKL
Copy link
Contributor Author

@alamb done

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.

Thanks @AugustoFKL

@alamb alamb merged commit f7f14df into sqlparser-rs:main Oct 4, 2022
@AugustoFKL AugustoFKL deleted the 647_ansii-character-string-types branch October 4, 2022 18:11
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.

ANSII character string types
3 participants