lightdb新增mysql模式下查询列时大小写不敏感、显示列大小写敏感

10 篇文章 0 订阅
8 篇文章 0 订阅

lightdb新增mysql模式下查询列时大小写不敏感、显示列大小写敏感

众所周知,lightdb在23.2版本前,查询列时,无论是否通过AS指定别名,只要没有使用双引号或是反引号,那么查询时会将其转化成小写后与表内字段进行对比,同时显示时也将小写的字段打印出来,给出如下几个示例:

create table test_case_1(identifier1 varchar(10));

select * from test_case_1;
identifier1
-------------
(0 rows)

select IDentifier1 from test_case_1;
identifier1
-------------
(0 rows)

select "IDentifier1" from test_case_1;
ERROR:  column "IDentifier1" does not exist

select identifier1 as IDentifier1 from test_case_1;
identifier1
-------------
(0 rows)

lightdb23.2版本在mysql模式下且设置guc参数’lightdb_sql_mode’包含’uppercase_identifier’参数值后,具有查询列时大小写不敏感、显示列时大小写敏感的特性。值得注意的是,guc参数’lightdb_sql_mode‘使能’uppercase_identifier’字段,建议放在lightdb.conf内,且之后尽量不修改,亦不建议通过会话来设置它:

-- 指定数据库级实例模式为mysql模式 
create database test_mysql_mode with lightdb_syntax_compatible_type mysql;
\c test_mysql_mode;

create table test_case_1(identifier1 varchar(10));

select * from test_case_1;
identifier1
-------------
(0 rows)

select IDentifier1 from test_case_1;
IDentifier1
-------------
(0 rows)

select identifier1 as IDentifier1 from test_case_1;
IDentifier1
-------------
(0 rows)
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值