Skip to content

fix: Add support for MAX for NVARCHAR#1232

Merged
alamb merged 1 commit intoapache:mainfrom
bombsimon:fix/nvarchar-support-max
Apr 26, 2024
Merged

fix: Add support for MAX for NVARCHAR#1232
alamb merged 1 commit intoapache:mainfrom
bombsimon:fix/nvarchar-support-max

Conversation

@bombsimon
Copy link
Copy Markdown
Contributor

NVARCHAR works similar to VARCHAR except it uses unicode for the character set. This means that it supports the MAX keyword for some dialects just like VARCHAR.

This will change the wrapped type for Nvarchar to a CharacterLength instead of u64.


The support for this was already mentioned in a comment in the code but wasn't supported so I was hoping this would be a reasonable change.

https://github.com/sqlparser-rs/sqlparser-rs/blob/ce85084debefd69d2d43a1bdde73e25f2cb0c9d6/src/ast/data_type.rs#L537-L538

`NVARCHAR` works similar to `VARCHAR` except it uses unicode for the
character set. This means that it supports the `MAX` keyword for some
dialects just like `VARCHAR`.

This will change the wrapped type for `Nvarchar` to a `CharacterLength`
instead of `u64`.
Copy link
Copy Markdown
Contributor

@iffyio iffyio left a comment

Choose a reason for hiding this comment

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

LGTM! cc @alamb

Copy link
Copy Markdown
Contributor

@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.

Thank you @bombsimon and @iffyio

@coveralls
Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 8812819014

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 6 of 6 (100.0%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.001%) to 89.222%

Totals Coverage Status
Change from base Build 8807696015: 0.001%
Covered Lines: 23187
Relevant Lines: 25988

💛 - Coveralls

@alamb alamb merged commit b51f2a0 into apache:main Apr 26, 2024
JichaoS pushed a commit to luabase/sqlparser-rs that referenced this pull request May 7, 2024
@bombsimon bombsimon deleted the fix/nvarchar-support-max branch September 11, 2024 21:14
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.

4 participants