From c9a2e5ab5931fac1dd6a37fc7315523b0333f679 Mon Sep 17 00:00:00 2001 From: yangj1211 Date: Tue, 21 May 2024 10:12:25 +0800 Subject: [PATCH] update doc of lower_case_tables_name --- .../lower_case_tables_name.md | 77 +++++++++++++------ 1 file changed, 54 insertions(+), 23 deletions(-) diff --git a/docs/MatrixOne/Reference/Variable/system-variables/lower_case_tables_name.md b/docs/MatrixOne/Reference/Variable/system-variables/lower_case_tables_name.md index 3f13075a1f..a018251ec2 100644 --- a/docs/MatrixOne/Reference/Variable/system-variables/lower_case_tables_name.md +++ b/docs/MatrixOne/Reference/Variable/system-variables/lower_case_tables_name.md @@ -1,31 +1,57 @@ # lower_case_table_names 大小写敏感支持 -`lower_case_table_names` 是 MatrixOne 设置大小写是否敏感的一个参数。 +`lower_case_table_names` 是 MatrixOne 设置大小写是否敏感的一个全局变量。 !!! note 与 mysql 不同的是,MatrixOne 暂时只支持 **0** 和 **1** 两种模式,且在 linux 和 mac 系统下默认值都为 1。 -## 配置 +## 查看 lower_case_table_names -在命令行执行以下语句: +在 MatrixOne 中使用以下命令查看 `lower_case_table_names`: ```sql -set global lower_case_table_names = 0;// 默认为 1,重新连接数据库生效 +show variables like "lower_case_table_names";--默认为 1 +``` + +## 设置 lower_case_table_names + +在 MatrixOne 中使用以下命令设置 `lower_case_table_names`: + +```sql +set global lower_case_table_names = 0;--默认为 1,重新连接数据库生效 ``` ## 参数解释 -### 0 +### 参数设置为 0 将 `lower_case_table_names` 设置为 0。标识符存储为原始字符串,名称比较大小写敏感。 **示例** ```sql +mysql> show variables like "lower_case_table_names";--查看默认参数,默认值为 1 ++------------------------+-------+ +| Variable_name | Value | ++------------------------+-------+ +| lower_case_table_names | 1 | ++------------------------+-------+ +1 row in set (0.00 sec) + +set global lower_case_table_names = 0;--重新连接数据库生效 + +mysql> show variables like "lower_case_table_names";--重连数据库查看参数,修改成功 ++------------------------+-------+ +| Variable_name | Value | ++------------------------+-------+ +| lower_case_table_names | 0 | ++------------------------+-------+ +1 row in set (0.00 sec) + create table Tt (Aa int); insert into Tt values (1), (2), (3); -mysql> select Aa from Tt; +mysql> select Aa from Tt;--名称比较大小写敏感 +------+ | Aa | +------+ @@ -36,17 +62,27 @@ mysql> select Aa from Tt; 3 rows in set (0.03 sec) ``` -### 1 +### 参数设置为 1 将 `lower_case_table_names` 设置为 1。标识符存储为小写,名称比较大小写不敏感。 **示例** ```sql -create table Tt (Aa int); -insert into Tt values (1), (2), (3); +set global lower_case_table_names = 1;--重新连接数据库生效 + +mysql> show variables like "lower_case_table_names";--重连数据库查看参数,修改成功 ++------------------------+-------+ +| Variable_name | Value | ++------------------------+-------+ +| lower_case_table_names | 1 | ++------------------------+-------+ +1 row in set (0.00 sec) + +create table Tt (Aa int,Bb int); +insert into Tt values (1,2), (2,3), (3,4); -mysql> select Aa from Tt; +mysql> select Aa from Tt;--名称比较大小写不敏感 +------+ | aa | +------+ @@ -55,20 +91,15 @@ mysql> select Aa from Tt; | 3 | +------+ 3 rows in set (0.03 sec) -``` - -```sql -create table t(a int); -insert into t values(1), (2), (3); -- 列的别名在返回结果集时会显示原始字符串,但名称比较时大小写不敏感,示例如下: -mysql> select A as Aa from t; -+------+ -| Aa | -+------+ -| 1 | -| 2 | -| 3 | -+------+ +mysql> select Aa as AA,Bb from Tt; ++------+------+ +| AA | bb | ++------+------+ +| 1 | 2 | +| 2 | 3 | +| 3 | 4 | ++------+------+ 3 rows in set (0.00 sec) ``` \ No newline at end of file