跳到主要内容
版本:1.0.14

其他与Oracle引擎相关的参数

  • transform_null_equals

由于针对NULL的任何操作都只会返回NULL,所以要判断一个值是否为NULL一般只能用IS NULL来判断。Halo提供了参数transform_null_equals来控制是否可以用“=”操作符来判断一个值是否为NULL。可以将参数transform_null_equals 设置为 on(默认为off)。

1、数据库中有一条空值记录,当参数transform_null_equals 状态等于off时,使用“=null”不能查询出空值记录

halo0root=# select * from test where id=null;


id

-------
(0 行记录)

2、数据库中有一条空值记录,当参数transform_null_equals 状态等于on时,使用“=null”可以查询出空值记录

halo0root=# select * from test where id=null;

id

----

(1 行记录)
  • use_datetime_as_date

Oracle的date 类型带有日期和时间信息,这和Halo的默认设置不同。默认情况下,Halo的date类型只包含日期,datetime类型才包含日期和时间信息。如果想要实现和Oracle相同的date类型,可以将参数use_datetime_as_date设置为true (默认值是 off)。注意,只有将database_compat_mode设置为Oracle模式时此参数才能生效。

use_datetime_as_date = true
  • standard_parserengine_auxiliary

默认情况下Oracle引擎不支持的语法会下传给Halo的默认引擎进行二次解析,以实现更好的兼容性。如果想关闭二次解析功能,可以设置standard_parserengine_auxiliary为'off'(默认为on),此时Oracle引擎碰到不支持的语法会直接报错。

standard_parserengine_auxiliary = 'off'

transform_null_string

在 Oracle 模式下有效。

transform_null_string参数目录 /data/halo/ postgresql.conf

当 transform_null_string 设为 true,空串'' 和 null 是等价的,这和 Oracle 的规范是一致的。

oracle.transform_null_string = true

create table test(name varchar2(20));

insert into test values('');

select * from test where name='';

name

------

(0 rows)



select * from test where name is null;

name

------

(1 row)

当 transform_null_string 设为 false,空串'' 和 null 是不等价的。

oracle.transform_null_string = false

create table test1 (name varchar(20));

insert into test1 values ('');

select * from test1 where name ='';

name

------

(1 row)


select * from test1 where name is null;

name

------

(0 rows)