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

Fix(mysql): convert (U)BIGINT to (UN)SIGNED in CAST expressions #1832

Merged
merged 1 commit into from
Jun 26, 2023

Conversation

georgesittas
Copy link
Collaborator

cc: @brosoul

Comment on lines +450 to +453
if expression.to.this == exp.DataType.Type.BIGINT:
to = "SIGNED"
elif expression.to.this == exp.DataType.Type.UBIGINT:
to = "UNSIGNED"
Copy link
Collaborator Author

@georgesittas georgesittas Jun 26, 2023

Choose a reason for hiding this comment

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

Didn't use is_type on purpose here, because it fails when to is an exp.CharacterSet.

For example, the following test case failed for this reason:

        self.validate_all(
            "CONVERT(x USING latin1)",
            write={
                "mysql": "CAST(x AS CHAR CHARACTER SET latin1)",
            },
        )

@tobymao tobymao merged commit f7abc28 into main Jun 26, 2023
@tobymao tobymao deleted the jo/mysql_bigint_fixup branch June 26, 2023 16:48
@brosoul
Copy link
Contributor

brosoul commented Jun 26, 2023

Thanks, the PR helped me better understand the Generator🫡

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