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

implement charset() function #2662

Merged
merged 3 commits into from
Sep 17, 2024
Merged

implement charset() function #2662

merged 3 commits into from
Sep 17, 2024

Conversation

jycor
Copy link
Contributor

@jycor jycor commented Sep 16, 2024

Copy link
Contributor

@fulghum fulghum left a comment

Choose a reason for hiding this comment

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

Looks good!

{
Query: "select charset(null)",
Expected: []sql.Row{
{"binary"},
Copy link
Contributor

Choose a reason for hiding this comment

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

weird that the docs say charset() returns null if the argument is null. I also see my version of MySQL returning binary here, so looks like MySQL's documentation is incorrect. 🤷🏻

@@ -144,3 +144,64 @@ func (c *Coercibility) Type() sql.Type {
func (*Coercibility) CollationCoercibility(ctx *sql.Context) (collation sql.CollationID, coercibility byte) {
return sql.Collation_binary, 5
}

// Charset is a function that returns the collation of the inner expression.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Charset is a function that returns the collation of the inner expression.
// Charset is a function that returns the character set of the inner expression.

if val == nil {
return sql.CharacterSet_binary.Name(), nil
}
// Otherwise, we return the collation calculated from the expression
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Otherwise, we return the collation calculated from the expression
// Otherwise, we return the character set calculated from the expression

@jycor jycor merged commit 90f3368 into main Sep 17, 2024
8 checks passed
@jycor jycor deleted the james/charset branch September 17, 2024 19: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.

2 participants