Repository: matrixorigin/matrixone
Pull request #13500 (2023-12-15 06:54:47)

fix incorrect version
## What type of PR is this?

- [ ] API-change
- [x] BUG
- [ ] Improvement
- [ ] Documentation
- [ ] Feature
- [ ] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

issue #13488 

## What this PR does / why we need it:
fix incorrect version


Patch:
diff --git a/pkg/frontend/authenticate.go b/pkg/frontend/authenticate.go
index faffab1dc..39594c785 100644
--- a/pkg/frontend/authenticate.go
+++ b/pkg/frontend/authenticate.go
@@ -8856,7 +8856,7 @@ func insertRecordToMoMysqlCompatibilityMode(ctx context.Context, ses *Session, s
 	var dbName string
 	var err error
 	variableName := "version_compatibility"
-	variableValue := "0.7"
+	variableValue := getVariableValue(ses.GetSysVar("version"))
 
 	if createDatabaseStmt, ok := stmt.(*tree.CreateDatabase); ok {
 		dbName = string(createDatabaseStmt.Name)


Test patch:
diff --git a/test/distributed/cases/database/config.result b/test/distributed/cases/database/config.result
index 893f2d0e3..22d2bd8a3 100644
--- a/test/distributed/cases/database/config.result
+++ b/test/distributed/cases/database/config.result
@@ -2,7 +2,7 @@ drop database if exists test;
 create database test;
 select `variable_value` from mo_catalog.mo_mysql_compatibility_mode where dat_name ="test";
 variable_value
-0.7
+8.0.30-MatrixOne-v1.0.0
 alter database test set mysql_compatibility_mode = '8.0.30-MatrixOne-v0.7.0';
 select `variable_value` from mo_catalog.mo_mysql_compatibility_mode where dat_name ="test";
 variable_value
@@ -13,7 +13,7 @@ create database test;
 use test;
 select version();
 version()
-0.7
+8.0.30-MatrixOne-v1.0.0
 alter database test set mysql_compatibility_mode = '8.0.30-MatrixOne-v0.7.0';
 select version();
 version()
@@ -28,7 +28,7 @@ create database test1;
 use test;
 select version();
 version()
-0.7
+8.0.30-MatrixOne-v1.0.0
 alter database test set mysql_compatibility_mode = '8.0.30-MatrixOne-v0.7.0';
 select version();
 version()
@@ -36,12 +36,12 @@ version()
 use test1;
 select version();
 version()
-0.7
+8.0.30-MatrixOne-v1.0.0
 alter account config abc set mysql_compatibility_mode = '8.0.30-MatrixOne-v0.8.0';
 internal error: do not have privileges to alter account config
 select version();
 version()
-0.7
+8.0.30-MatrixOne-v1.0.0
 drop database test;
 drop database test1;
 drop account abc;
@@ -90,4 +90,4 @@ SELECT @@GLOBAL.sql_mode;
 @@sql_mode
 STRICT_TRANS_TABLES
 set global sql_mode = "ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES";
-drop account abc;
\ No newline at end of file
+drop account abc;
diff --git a/test/distributed/cases/zz_accesscontrol/account_restricted.result b/test/distributed/cases/zz_accesscontrol/account_restricted.result
index 0519eb00e..79b714355 100644
--- a/test/distributed/cases/zz_accesscontrol/account_restricted.result
+++ b/test/distributed/cases/zz_accesscontrol/account_restricted.result
@@ -187,7 +187,7 @@ Tables_in_res_test    Table_type
 r_test    BASE TABLE
 select version();
 version()
-0.7
+8.0.30-MatrixOne-v1.0.0
 alter database test set mysql_compatibility_mode = '8.0.30-MatrixOne-v0.7.0';
 internal error: do not have privilege to execute the statement
 select privilege_name, obj_type, privilege_level from mo_catalog.mo_role_privs where privilege_name = 'values';