Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions enginetest/queries/insert_queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -1278,10 +1278,10 @@ var InsertScripts = []ScriptTest{
},
},
{
Name: "sql_mode=NO_AUTO_VALUE_ON_ZERO",
Name: "sql_mode=NO_auto_value_ON_ZERO",
SetUpScript: []string{
"set @old_sql_mode=@@sql_mode;",
"set @@sql_mode='NO_AUTO_VALUE_ON_ZERO';",
"set @@sql_mode='NO_auto_value_ON_ZERO';",
"create table auto (i int auto_increment, index (i));",
"create table auto_pk (i int auto_increment primary key);",
},
Expand Down
2 changes: 1 addition & 1 deletion sql/types/system_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var _ sql.CollationCoercible = systemSetType{}

// NewSystemSetType returns a new systemSetType.
func NewSystemSetType(varName string, values ...string) sql.SystemVariableType {
return systemSetType{MustCreateSetType(values, sql.Collation_Default), varName}
return systemSetType{MustCreateSetType(values, sql.Collation_ascii_general_ci), varName}
Copy link
Contributor

@jycor jycor Oct 16, 2024

Choose a reason for hiding this comment

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

We shouldn't change all our system types to use that collation, and they should still use collation_default. Also it should be utf8mb4_0900_ai_ci and not utf8mb4_ascii_general_ci.

Instead, NewSystemSetType() should take in a sql.CollationID and we should pass it sql.Collation_utf8mb4_0900_ai_ci for sql_mode in go-msql-server/sql/variables/system_variables.go.

Fortunately, NewSystemSetType() is only used in a few places, so there won't be too many changes.

Copy link
Contributor Author

@fanyang01 fanyang01 Oct 17, 2024

Choose a reason for hiding this comment

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

Hi @jycor, thanks for your review! I'm uncertain about which collation should be used for other system variables. Could you please direct me to where I can find MySQL's implementation?

mysql> set global log_output = 'table,file';
Query OK, 0 rows affected (0.00 sec)

mysql> select @@global.log_output;
+---------------------+
| @@global.log_output |
+---------------------+
| FILE,TABLE          |
+---------------------+
1 row in set (0.00 sec)

mysql> set global log_output = default;
Query OK, 0 rows affected (0.00 sec)

mysql> select @@global.log_output;
+---------------------+
| @@global.log_output |
+---------------------+
| FILE                |
+---------------------+
1 row in set (0.00 sec)

mysql> set global protocol_compression_algorithms = 'zLIB,Zstd';
Query OK, 0 rows affected (0.01 sec)

mysql> select @@global.protocol_compression_algorithms;
+------------------------------------------+
| @@global.protocol_compression_algorithms |
+------------------------------------------+
| zLIB,Zstd                                |
+------------------------------------------+
1 row in set (0.01 sec)

mysql> set global protocol_compression_algorithms = default;
Query OK, 0 rows affected (0.00 sec)

mysql> select @@global.protocol_compression_algorithms;
+------------------------------------------+
| @@global.protocol_compression_algorithms |
+------------------------------------------+
| zlib,zstd,uncompressed                   |
+------------------------------------------+
1 row in set (0.00 sec)

Copy link
Contributor Author

@fanyang01 fanyang01 Oct 17, 2024

Choose a reason for hiding this comment

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

I have learned the following facts from MySQL's source code:

}

// Compare implements Type interface.
Expand Down
Loading