平台和客户端兼容性
很多平台都使用数据库系统,数据库系统的对外兼容性给平台提供了很大的方便。
a_format_date_timestamp
参数说明:控制返回日期时间。
在ORA模式下,当事务开启时,函数current_date、current_timestamp、localtimestamp返回当前SQL启动的时间戳。
参数类型:布尔型
参数单位:无
取值范围:
- on:返回当前SQL启动的时间戳
- off:返回事务开启的日期或日期及时间
默认值:off
设置方式:该参数属于USERSET类型参数,请参见表1中对应设置方法进行设置。
设置建议:推荐使用默认值。在开启事务需要返回系统时间时可开启该参数。
transform_null_equals
参数说明:控制表达式expr = NULL(或NULL = expr)当做expr IS NULL处理。如果expr得出NULL值则返回真,否则返回假。
- 正确的SQL标准兼容的expr = NULL总是返回NULL(未知)。
- Microsoft Access里的过滤表单生成的查询使用expr = NULL来测试空值。打开这个选项,可以使用该接口来访问数据库。
该参数属于USERSET类型参数,请参考表1中对应设置方法进行设置。
取值范围:布尔型
- on表示控制表达式expr = NULL(或NULL = expr)当做expr IS NULL处理。
- off表示不控制,即expr = NULL总是返回NULL(未知)。
默认值:off
![](https://support.huaweicloud.com/intl/zh-cn/distributed-devg-v8-gaussdb/public_sys-resources/note_3.0-zh-cn.png)
新用户经常在涉及NULL的表达式上语义混淆,故默认值设为off。
support_extended_features
参数说明:控制是否支持数据库的扩展特性。
该参数属于POSTMASTER类型参数,请参考表1中对应设置方法进行设置。
取值范围:布尔型
- on表示支持数据库的扩展特性。
- off表示不支持数据库的扩展特性。
默认值:off
character_set_connection
参数说明:用于设置常量字符串的字符集。修改该参数会同步将collation_connection修改成该字符集的默认字符序。仅在sql_compatibility = 'MySQL'兼容模式下,并在设置b_format_version='5.7'、b_format_dev_version='s2'时生效。
参数类型:字符型
参数单位:无
取值范围:sql_compatibility = 'MySQL'兼容性模式下支持的字符集。参见《开发指南》中“SQL参考 > SQL语法 >C > CREATE TABLE”章节中的“COLLATE collation”。暂不支持设置成与当前数据库字符集不同的值。
默认值:与当前server_encoding保持一致。
设置方式:该参数属于USERSET类型参数,请参考表1中对应设置方法进行设置(但不支持通过GUC工具设置)。
设置建议:无
collation_connection
参数说明:用于设置常量字符串的字符序。修改该参数会同步将character_set_connection修改成该字符序的默认字符集。仅在sql_compatibility = 'MySQL'兼容模式下,并在设置b_format_version='5.7'、b_format_dev_version='s2'时生效。
参数类型:字符型
参数单位:无
取值范围:sql_compatibility = 'MySQL'兼容性模式下支持的字符序。参见《开发指南》中“SQL参考 > SQL语法 >C > CREATE TABLE”章节中的“COLLATE collation”。暂不支持设置成当前数据库字符集对应字符序之外的值。
默认值:当前server_encoding的默认字符序,若没有server_encoding的默认字符序,则为default。
设置方式:该参数属于USERSET类型参数,请参考表1中对应设置方法进行设置(但不支持通过GUC工具设置)。
设置建议:无
character_set_results
参数说明:用于设置返回结果的字符集。仅在sql_compatibility = 'MySQL'兼容模式下,并在设置b_format_version='5.7'、b_format_dev_version='s2'时生效。
参数类型:字符型
参数单位:无
取值范围:sql_compatibility = 'MySQL'兼容性模式下支持的字符集。参见《开发指南》中“SQL参考 > SQL语法 >C > CREATE TABLE”章节中的“COLLATE collation”。还可以设置成null或'',此时直接以数据库的字符集输出。
默认值:与当前server_encoding保持一致。
设置方式:该参数属于USERSET类型参数,请参考表1中对应设置方法进行设置(但不支持通过GUC工具设置)。
设置建议:无
lastval_supported
参数说明:控制是否可以使用lastval函数。
该参数属于POSTMASTER类型参数,请参考表1中对应设置方法进行设置。
取值范围:布尔型
- on表示支持lastval函数,同时nextval函数不支持下推。
- off表示不支持lastval函数,同时nextval函数可以下推。
默认值:off
group_concat_max_len
参数说明:搭配函数GROUP_CONCAT使用,限制其返回值长度,超长截断。
参数类型:整型
参数单位:无
取值范围:0~9223372036854775807,目前实际生效的最大长度是1073741823,超出此长度后会有out of memory的报错。
默认值:1024
设置方式:该参数属于USERSET类型参数,请参见表1中对应设置方法进行设置。
设置建议:推荐使用默认值。
sql_compatibility
参数说明:控制数据库的SQL语法和语句行为同哪一个主流数据库兼容。该参数属于INTERNAL类型参数,用户无法修改,只能查看。
取值范围:枚举型
- ORA表示同Oracle数据库兼容。
- TD表示同Teradata数据库兼容。
- MYSQL表示同MySQL数据库兼容。
- PG表示同PostgreSQL数据库兼容。
默认值:MYSQL
![](https://support.huaweicloud.com/intl/zh-cn/distributed-devg-v8-gaussdb/public_sys-resources/notice_3.0-zh-cn.png)
- 该参数只能在执行CREATE DATABASE命令(详见《开发指南》的“SQL参考 > SQL语法 > CREATE DATABASE”章节)创建数据库的时候设置。
- 在数据库中,该参数只能是确定的一个值,要么始终设置为ORA,要么始终设置为TD,请勿任意改动,否则会导致数据库行为不一致。
b_format_behavior_compat_options
参数说明:数据库MYSQL模式兼容性行为配置项。
参数类型:字符串
参数单位:无
取值范围:当前只支持表1 B模式兼容性配置项,当设置多个兼容性配置项时,相邻配置项之间用逗号隔开。
默认值:""
![](https://support.huaweicloud.com/intl/zh-cn/distributed-devg-v8-gaussdb/public_sys-resources/note_3.0-zh-cn.png)
此参数在b_format_version参数设置不为''时,b_format_behavior_compat_options会被设置为"all",而且不能被修改。
兼容性配置项 |
兼容性行为控制 |
---|---|
default_collation |
默认字符序前向兼容开关。
|
all |
打开所有语法控制开关。 all不能同时和其他配置项一起指定。表格中除all外所有配置项逗号隔开的含义和取值为all含义相同。 |
设置方式:该参数属于USERSET类型参数,请参考表1中对应设置方法进行设置。
设置建议:控制一些MYSQL兼容性特性是否可用,若要更改,请在理解参数含义后谨慎操作,避免因误操作产生意料之外的风险。
behavior_compat_options
参数说明:数据库兼容性行为配置项。
参数类型:字符串
参数单位:无
取值范围:当前只支持表2,当设置多个兼容性配置项时,相邻配置项之间用逗号隔开,例如:set behavior_compat_options='end_month_calculate,display_leading_zero';。
默认值:"enable_bpcharlikebpchar_compare,enable_crosstype_integer_operator"
兼容性配置项 |
兼容性行为控制 |
||||
---|---|---|---|---|---|
display_leading_zero |
浮点数显示配置项。控制数值类型中char、character、nchar、varchar、character varying、varchar2、nvarchar2、text、clob等所有字符串类型和float4、float8、numeric等任意精度类型的小数点前零的显示,length计算数字长度同步显示。
|
||||
end_month_calculate |
add_months函数计算逻辑配置项。 假定函数add_months的两个参数分别为param1和param2,param1的月份和param2的和为月份result。
|
||||
compat_analyze_sample |
analyze采样行为配置项。 设置此配置项时,会优化analyze的采样行为,主要体现在analyze时全局采样会更精确的控制在3万条左右,更好的控制analyze时Coordinator端的内存消耗,保证analyze性能的稳定性。 |
||||
bind_schema_tablespace |
绑定模式与同名表空间配置项。 如果存在与模式名sche_name相同的表空间名,那么如果设置search_path为sche_name,default_tablespace也会同步切换到sche_name。 |
||||
bind_procedure_searchpath |
未指定模式名的存储过程中的数据库对象的搜索路径配置项。 在存储过程中如果不显示指定模式名,会优先在存储过程所属的模式下搜索。 如果找不到,则有两种情况:
|
||||
correct_to_number |
控制to_number()结果兼容性的配置项。
|
||||
unbind_divide_bound |
控制对整数除法的结果进行范围校验。
|
||||
convert_string_digit_to_numeric |
控制当表中以字符串形式表示的numeric常量和数字类型做比较时,是否都统一转换为numeric类型再进行比较。
|
||||
return_null_string |
控制函数lpad()和rpad()结果为空字符串''的显示配置项。
|
||||
compat_concat_variadic |
控制函数concat()和concat_ws()对variadic类型结果兼容性的配置项。由于MySQL数据库无variadic类型,所以该选项对MY数据库无影响。
|
||||
merge_update_multi |
控制在使用MERGE INTO ... WHEN MATCHED THEN UPDATE(参考《开发指南》的“SQL参考 > SQL语法 > MERGE INTO”章节)和INSERT ... ON DUPLICATE KEY UPDATE(参考《开发指南》的“SQL参考 > SQL语法 > INSERT”章节)时,当目标表中一条目标数据与多条源数据冲突时UPDATE行为。
|
||||
plstmt_implicit_savepoint |
控制存储过程中更新语句的执行是否拥有独立的子事务。 若设置此配置项,存储过程中每条更新语句前开启隐式保存点,EXCEPTION块中默认回退到最近的保存点,从而保证只回退失败语句的修改。该选项是为了兼容ORA数据库的EXCEPTION行为。 |
||||
hide_tailing_zero |
numeric显示配置项。
例如: gaussdb=# set behavior_compat_options='hide_tailing_zero'; gaussdb=# select cast(123.123 as numeric(15,10)) as a, to_char(cast(123.123 as numeric(15,10)), '999D999999'); a | to_char ---------+---------- 123.123 | 123.123 (1 row) gaussdb=# set behavior_compat_options=''; gaussdb=# select cast(123.123 as numeric(15,10)) as a, to_char(cast(123.123 as numeric(15,10)), '999D999999'); a | to_char ----------------+------------- 123.1230000000 | 123.123000 (1 row) |
||||
plsql_security_definer |
开启此参数后,创建存储过程时默认为定义者权限。 |
||||
char_coerce_compat |
控制char(n)类型向其它变长字符串类型转换时的行为。该参数仅在sql_compatibility参数的值为ORA时生效,并且开启该参数后无论是隐式转换、显式转换还是通过调用text(bpchar)函数转换类型都不再省略尾部空格。
gaussdb=# set behavior_compat_options=''; gaussdb=# create table tab_1(col1 varchar(3)); gaussdb=# create table tab_2(col2 char(3)); gaussdb=# insert into tab_2 values(' '); gaussdb=# insert into tab_1 select col2 from tab_2; gaussdb=# select * from tab_1 where col1 is null; col1 ------ (1 row) gaussdb=# select * from tab_1 where col1=' '; col1 ------ (0 rows) gaussdb=# delete from tab_1; gaussdb=# set behavior_compat_options = 'char_coerce_compat'; gaussdb=# insert into tab_1 select col2 from tab_2; gaussdb=# select * from tab_1 where col1 is null; col1 ------ (0 rows) gaussdb=# select * from tab_1 where col1=' '; col1 ------ (1 row) |
||||
truncate_numeric_tail_zero |
numeric显示配置项。
例如: gaussdb=# set behavior_compat_options='truncate_numeric_tail_zero'; gaussdb=# select cast(123.123 as numeric(15,10)) as a, to_char(cast(123.123 as numeric(15,10)), '999D999999'); a | to_char ---------+------------- 123.123 | 123.123000 (1 row) gaussdb=# set behavior_compat_options=''; gaussdb=# select cast(123.123 as numeric(15,10)) as a, to_char(cast(123.123 as numeric(15,10)), '999D999999'); a | to_char ----------------+------------- 123.1230000000 | 123.123000 (1 row) |
||||
plpgsql_dependency |
已废弃。 |
||||
disable_rewrite_nesttable |
分布式不支持。 |
||||
proc_outparam_override |
控制存储过程出参的重载行为,打开该参数后,对于存储过程只有out出参部分不同的情况,也可以正常创建和调用。目前只有gsql与jdbc连接数据库时可以使用该参数,对于其他工具打开该参数连接数据库时无法正常调用带有out的存储过程。 支持out出参正常赋值。 |
||||
aformat_regexp_match |
控制正则表达式函数的匹配行为。
设置此项,且sql_compatibility参数的值为ORA或MYSQL时,正则表达式的 flags 参数支持的选项含义:
否则,正则表达式的 flags 参数支持的选项含义:
|
||||
disable_emptystr2null |
A兼容模式绑参场景中,开启此参数后,关闭默认将字符类型传参的值从空串转换为null功能。包括text、clob、blob、raw、bytea、varchar、nvarchar2、bpchar、char、name、byteawithoutorderwithqualcol、byteawithoutordercol类型。该参数为逃生参数,非必要用户不要自行设置。 |
||||
select_into_return_null |
该参数在分布式场景下无效。 |
||||
proc_uncheck_default_param |
函数调用时不检查默认参数省略情况配置项。
|
||||
dynamic_sql_compat |
开启此参数后: 1. 动态语句不会将模板SQL中的同名模板参数视为同一个变量,而是按照顺序依次匹配using子句中的变量值。 2. 动态语句执行语句时调用存储过程的场景,会对存储过程中参数的IN/OUT属性和using子句中的IN/OUT属性进行检查。
注意:
动态语句执行匿名块语句时调用存储过程的场景,只针对IN参数进行矫正,如果需要对OUT参数进行检查需要设置proc_outparam_override选项。 |
||||
dynamic_sql_check |
开启此参数后,动态语句模板SQL中的不同模板参数个数与using子句中的变量个数不同时,将会在动态语句执行期间报错。
注意:
|
||||
enable_funcname_with_argsname |
开启参数后,使用select调用函数时投影别名显示完整函数。
|
||||
proc_outparam_transfer_length |
开启此参数后,存储过程和函数支持out出参长度传递,会在内层存储过程或者函数中报错。例如: gaussdb=# SET behavior_compat_options='proc_outparam_override,proc_outparam_transfer_length'; SET gaussdb=# CREATE OR REPLACE PROCEDURE out_param_test1(m in int, v inout varchar2,v1 inout varchar2) is gaussdb$# begin gaussdb$# v := 'aaaddd'; gaussdb$# v1 := 'aaaddd'; gaussdb$# end; gaussdb$# / CREATE PROCEDURE gaussdb=# CREATE OR REPLACE PROCEDURE call_out_param_test1 is gaussdb$# v varchar2(5) := 'aabbb'; gaussdb$# v1 varchar2(6) := 'aabb'; gaussdb$# begin gaussdb$# out_param_test1(5,v,v1); gaussdb$# end; gaussdb$# / CREATE PROCEDURE gaussdb=# CALL call_out_param_test1(); ERROR: value too long for type character varying(5) CONTEXT: PL/SQL function out_param_test1(integer,character varying,character varying) line 3 at assignment PL/SQL function call_out_param_test1() line 4 at SQL statement |
||||
varray_compat |
该参数在分布式场景下无效。 |
||||
allow_rownum_alias |
开启此参数后,将允许ROWNUM在SQL语句中通过AS语法用作列的别名,ROWNUM将作为普通标识符使用,不再能够作为伪列使用。
警告:
不建议在执行业务期间变更该参数的状态。开启参数的状态下,在数据库中用ROWNUM作为名称创建的数据库对象(如表名,列名,数据库名等)只能在开启参数的情况下使用,否则将会产生歧义,行为不可预期。关闭参数的状态下,在数据库中ROWNUM作为伪列使用的行为将在开启参数后失效,行为不可预期。 |
||||
current_sysdate |
开启此参数后,执行sysdate时,会获取当前操作系统时间。 gaussdb=# set behavior_compat_options='current_sysdate'; SET gaussdb=# select sysdate; current_sysdate --------------------- 2023-06-20 20:15:27 (1 row) |
||||
allow_function_procedure_replace |
默认场景下,对于ORA和PG兼容模式,当有一个包外的存储过程(或函数)时,创建一个同名的函数(或存储过程),与已有对象类型不同,不支持创建并报错。开启此参数后,通过create or replace的方式可以实现包外同名的存储过程和函数对象之间的类型替换。 gaussdb=# create or replace function proc_test return varchar2 as gaussdb$# begin gaussdb$# return '1'; gaussdb$# end; gaussdb$# / CREATE FUNCTION gaussdb=# create or replace procedure proc_test as gaussdb$# begin gaussdb$# null; gaussdb$# end; gaussdb$# / ERROR: cannot change routine kind DETAIL: "proc_test" is a function. gaussdb=# \df+ proc_test List of functions Schema | Name | Result data type | Argument data types | Type | Volatility | Owner | Language | Source code | Description | fencedmode | propackage | prokind --------+-----------+-------------------+---------------------+--------+------------+-----------+----------+-------------+-------------+------------+------------+--------- public | proc_test | character varying | | normal | volatile | wangxinyu | plpgsql | DECLARE +| | f | f | f | | | | | | | | begin +| | | | | | | | | | | | return '1';+| | | | | | | | | | | | end | | | | (1 row) -- 设置参数后允许替换类型 gaussdb=# set behavior_compat_options='allow_function_procedure_replace'; SET gaussdb=# create or replace procedure proc_test as gaussdb$# begin gaussdb$# null; gaussdb$# end; gaussdb$# / CREATE PROCEDURE gaussdb=# \df+ proc_test List of functions Schema | Name | Result data type | Argument data types | Type | Volatility | Owner | Language | Source code | Description | fencedmode | propackage | prokind --------+-----------+------------------+---------------------+--------+------------+-----------+----------+-------------+-------------+------------+------------+--------- public | proc_test | void | | normal | volatile | wangxinyu | plpgsql | DECLARE +| | f | f | p | | | | | | | | begin +| | | | | | | | | | | | null; +| | | | | | | | | | | | end | | | | (1 row) |
||||
collection_exception_backcompat |
控制在PL/SQL中集合类型相关报错抛出的异常值,当前控制3种异常值,对应关系如下: 未开启该参数 开启该参数 collection_is_null program_limit_exceeded subscript_beyond_count program_limit_exceeded subscript_outside_limit program_limit_exceeded 用例: gaussdb=# create or replace procedure p1 is gaussdb$# type t1 is table of int; gaussdb$# v t1; gaussdb$# v_int int; gaussdb$# begin gaussdb$# v_int := v.count(); gaussdb$# exception when collection_is_null then gaussdb$# raise info '%', sqlerrm; gaussdb$# end; gaussdb$# / CREATE PROCEDURE gaussdb=# call p1(); INFO: Reference to uninitialized collection p1 ---- (1 row) gaussdb=# create or replace procedure p1 is gaussdb$# type t1 is table of int; gaussdb$# v t1 := t1(1, 2, 3); gaussdb$# v_int int; gaussdb$# begin gaussdb$# v_int := v(4); gaussdb$# exception when subscript_beyond_count then gaussdb$# raise info '%', sqlerrm; gaussdb$# end; gaussdb$# / CREATE PROCEDURE gaussdb=# gaussdb=# call p1(); INFO: Subscript beyond count p1 ---- (1 row) gaussdb=# create or replace procedure p1 is gaussdb$# type t1 is table of int; gaussdb$# v t1 := t1(1, 2, 3); gaussdb$# v_int int; gaussdb$# begin gaussdb$# v_int := v(-1); gaussdb$# exception when subscript_outside_limit then gaussdb$# raise info '%', sqlerrm; gaussdb$# end; gaussdb$# / CREATE PROCEDURE gaussdb=# gaussdb=# call p1(); INFO: Subscript outside of limit p1 ---- (1 row) gaussdb=# set behavior_compat_options = 'collection_exception_backcompat'; SET gaussdb=# create or replace procedure p1 is gaussdb$# type t1 is table of int; gaussdb$# v t1; gaussdb$# v_int int; gaussdb$# begin gaussdb$# v_int := v.count(); gaussdb$# exception when program_limit_exceeded then gaussdb$# raise info '%', sqlerrm; gaussdb$# end; gaussdb$# / CREATE PROCEDURE gaussdb=# call p1(); INFO: Reference to uninitialized collection p1 ---- (1 row) gaussdb=# create or replace procedure p1 is gaussdb$# type t1 is table of int; gaussdb$# v t1 := t1(1, 2, 3); gaussdb$# v_int int; gaussdb$# begin gaussdb$# v_int := v(4); gaussdb$# exception when program_limit_exceeded then gaussdb$# raise info '%', sqlerrm; gaussdb$# end; gaussdb$# / CREATE PROCEDURE gaussdb=# gaussdb=# call p1(); INFO: Subscript beyond count p1 ---- (1 row) gaussdb=# create or replace procedure p1 is gaussdb$# type t1 is table of int; gaussdb$# v t1 := t1(1, 2, 3); gaussdb$# v_int int; gaussdb$# begin gaussdb$# v_int := v(-1); gaussdb$# exception when program_limit_exceeded then gaussdb$# raise info '%', sqlerrm; gaussdb$# end; gaussdb$# / CREATE PROCEDURE gaussdb=# gaussdb=# call p1(); INFO: Subscript outside of limit p1 ---- (1 row) |
||||
enable_case_when_alias |
开启该参数后,case when和decode语法的别名为以__unnamed_开头的字符串 用例: gaussdb=# set behavior_compat_options='enable_case_when_alias'; SET gaussdb=# create table test(c1 varchar2); CREATE TABLE gaussdb=# insert into test values('x'); INSERT 0 1 gaussdb=# select decode(c1,'x','0','default') from test; __unnamed_decode__ -------------------- 0 (1 row) gaussdb=# select (case c1 when 'x' then '0' else 'default' end) from test; __unnamed_case_when__ ----------------------- 0 (1 row) |
||||
plsql_rollback_keep_user |
控制在PL/SQL中rollback和rollback to savepoint是否回退当前用户。当开启此参数时,PL/SQL中rollback将不会修改当前用户。 用例: gaussdb=# create user plsql_rollback1 password 'huawei@123'; gaussdb=# create user plsql_rollback2 password 'huawei@123'; gaussdb=# grant plsql_rollback1 to plsql_rollback2; gaussdb=# create or replace procedure plsql_rollback1.p1 () authid definer gaussdb-# as gaussdb$# va int; gaussdb$# begin gaussdb$# raise info 'current usr:%', current_user; gaussdb$# rollback; gaussdb$# raise info 'current usr:%', current_user; gaussdb$# end; gaussdb$# / CREATE PROCEDURE gaussdb=# set session AUTHORIZATION plsql_rollback2 PASSWORD 'huawei@123'; SET gaussdb=> set behavior_compat_options = 'plsql_rollback_keep_user'; SET gaussdb=> call plsql_rollback1.p1 (); INFO: current usr:plsql_rollback1 INFO: current usr:plsql_rollback1 p1 ---- (1 row)
注意:
|
||||
enable_bpcharlikebpchar_compare |
启用/关闭bpcharlikebpchar和bpcharnlikebpchar操作符。
说明:
|
||||
cursor_asensitive |
打开该参数后,游标数据敏感行为兼容505.1之前版本。默认关闭该参数,数据库实现数据非敏感游标。
|
||||
enable_crosstype_integer_operator |
启用/关闭跨类型整型操作符。
说明:
|
||||
time_constexpr_compact |
打开该参数后,执行时间表达式场景,会根据常量是否含有时区,自动返回with timezone类型或without timezone类型。 目前支持timestamp类型、time类型。 --执行不带时区的时间戳表达式。 gaussdb=# SELECT timestamp '1999-03-15 8:00:00'; timestamp --------------------- 1999-03-15 08:00:00 (1 row) --执行带时区的时间戳表达式 返回timestamp with time zone类型。 gaussdb=# SELECT timestamp '1999-03-15 8:00:00 -8:00:00'; timestamptz ------------------------ 1999-03-16 00:00:00+08 (1 row) |
设置方式:该参数属于USERSET类型参数,请参考表1中对应设置方法进行设置。
设置建议:根据数据库兼容对象进行调整。
a_format_version
参数说明:数据库平台兼容性行为配置项,该参数的值为字符串枚举值。
该参数属于USERSET类型参数,请参考表1中对应设置方法进行设置。
取值范围:字符串
默认值:""
![](https://support.huaweicloud.com/intl/zh-cn/distributed-devg-v8-gaussdb/public_sys-resources/notice_3.0-zh-cn.png)
- 当前只支持兼容性配置项如表3所示。
- 兼容性配置项时设置字符串,例如:set a_format_version='10c';
a_format_dev_version
参数说明:数据库平台迭代小版本兼容性行为配置项,该参数的值为字符串枚举值。
该参数属于USERSET类型参数,请参考表1中对应设置方法进行设置。
取值范围:字符串
默认值:""
![](https://support.huaweicloud.com/intl/zh-cn/distributed-devg-v8-gaussdb/public_sys-resources/notice_3.0-zh-cn.png)
- 当前只支持兼容性配置项如表4所示。
- 兼容性配置项时设置字符串,例如:set a_format_dev_version='s1';
兼容性配置项 |
兼容性行为控制 |
---|---|
s1 |
|
s2 |
|
s3 |
|
s4 |
|
s5 |
|
b_format_version
参数说明:数据库平台兼容性行为配置项,用于控制MySQL兼容模式下的前向兼容性。
![](https://support.huaweicloud.com/intl/zh-cn/distributed-devg-v8-gaussdb/public_sys-resources/note_3.0-zh-cn.png)
- 仅当sql_compatibility兼容性参数设置为MYSQL时,b_format_version参数才会生效。
- 当该参数设置不为空字符串生效时,会同时设置参数b_format_behavior_compat_options为'ALL'值,参数bytea_output为'escape'值。当该参数重新设置为空字符串生效时,会将b_format_behavior_compat_options、bytea_output参数设为原来的值。
参数类型:字符串
参数单位:无
取值范围:空字符串''或 '5.7'
默认值:空字符串''
设置方式:该参数属于USERSET类型参数,请参考表1中对应设置方法进行设置。
设置建议:无
b_format_dev_version
参数说明:数据库平台迭代小版本兼容性行为配置项。
![](https://support.huaweicloud.com/intl/zh-cn/distributed-devg-v8-gaussdb/public_sys-resources/note_3.0-zh-cn.png)
依赖sql_compatibility兼容性参数设置为MYSQL且b_format_version设置为5.7时,b_format_dev_version才会生效。
参数类型:字符串
参数单位:无
取值范围:空字符串''或表5中的兼容性配置项。
默认值:空字符串''
设置方式:该参数属于USERSET类型参数,请参考表1中对应设置方法进行设置。
设置建议:无
sql_mode
参数说明:MySQL兼容模式下SQL行为控制配置项。
![](https://support.huaweicloud.com/intl/zh-cn/distributed-devg-v8-gaussdb/public_sys-resources/note_3.0-zh-cn.png)
依赖sql_compatibility兼容性参数设置为MYSQL、b_format_version设置为'5.7'、b_format_dev_version 设置为's1'时,sql_mode才会生效。
参数类型:字符串
参数单位:无
取值范围:空字符串''或 'strict_trans_tables,only_full_group_by,no_zero_in_date,no_zero_date,error_for_division_by_zero,no_auto_create_user,no_engine_substitution,pad_char_to_full_length'中的选项值。每个选项值的含义如表6所述。
兼容性配置项 |
兼容性行为控制 |
参数配置说明 |
---|---|---|
strict_trans_tables |
当前仅支持对MySQL兼容数据库下数据类型及系统函数做校验。 设置时,对输入的参数格式和范围做严格校验。无效值输入或者超过范围时,解析报error。 不设置时,对输入的参数格式和范围做宽松校验,无效值输入或者超过范围时,解析报warning,返回对应数据的0值。 |
可独立设置和取消。 |
only_full_group_by |
不允许出现非GROUP BY的key值、且不是常量和聚集函数的投影列。 |
可独立设置和取消,但无实际作用。 |
no_zero_in_date |
不允许日期中的年、月、日是0值。 |
可独立设置和取消,但无实际作用。 |
no_zero_date |
不允许日期是0值(0000-00-00)。 |
可独立设置和取消,但无实际作用。 |
error_for_division_by_zero |
不允许被0除。 |
可独立设置和取消,但无实际作用。 |
no_auto_create_user |
无实际作用,仅用作 SET SQL_MODE 语句包含此选项时不报错的兼容作用。 |
可独立设置和取消。 |
no_engine_substitution |
无实际作用,仅用作 SET SQL_MODE 语句包含此选项时不报错的兼容作用。 |
可独立设置和取消。 |
pad_char_to_full_length |
用于表中的char类型列格式化输出,包含时输出带有尾部空格的字符串,否则输出不带尾部空格字符串。 |
可独立设置和取消。 |
no_auto_value_on_zero |
包含此选项后,向AUTO_INCREMENT自动增长列插入0值将不会自增。 |
可独立设置和取消。 |
默认值:'strict_trans_tables,only_full_group_by,no_zero_in_date,no_zero_date,error_for_division_by_zero,no_auto_create_user,no_engine_substitution'
设置方式:该参数属于USERSET类型参数,请参考表1中对应设置方法进行设置。
设置建议:无
auto_increment_increment
参数说明:AUTO_INCREMENT自动增长列的自增步长,自增值将由auto_increment_offset + N × auto_increment_increment计算而来,N为正整数。若参数值小于auto_increment_offset,自动增长列自增时会产生错误。
参数类型:整型
参数单位:无
取值范围:1 ~ 65535
默认值:1
设置方式:该参数属于USERSET类型参数,请参考表1中对应设置方法进行设置。
设置建议:无
auto_increment_offset
参数说明:AUTO_INCREMENT自动增长列的起始值,自增值将由auto_increment_offset + N × auto_increment_increment计算而来,N为正整数。若参数值大于auto_increment_increment,自动增长列自增时会产生错误。
参数类型:整型
参数单位:无
取值范围:1 ~ 65535
默认值:1
设置方式:该参数属于USERSET类型参数,请参考表1中对应设置方法进行设置。
设置建议:无
auto_increment_cache
参数说明:对自动增长列批量插入或导入触发自增时,预留自增缓存值的个数。预留自增值时,刷新自增计数器为自增缓存值的最大值,缓存值使用完毕之前,自增计数器值不变,触发自增使用缓存的值。
![](https://support.huaweicloud.com/intl/zh-cn/distributed-devg-v8-gaussdb/public_sys-resources/note_3.0-zh-cn.png)
- 预留的缓存值仅在语句内有效,若预留的自增缓存值没有全部被使用,后续插入语句基于自增计数器触发自增,会出现表中自动增长列的值不连续的情况。
- 并行导入或插入自动增长列触发自增时,每个并行线程预留的缓存值也只在其线程中使用,未完全使用完毕的话,也会出现表中自动增长列的值不连续的情况。
- 对已有数据的表添加自动增长列或修改某列为自动增长列时,已有数据触发自增,预留自增缓存值也受此参数影响。
- 此参数不影响本地临时表中的自动增长列。
默认值:0
参数类型:整型
参数单位:无
取值范围:0 ~ INT_MAX
- 参数值为0时,自动预留自增缓存值。
- 第一次触发自增时,若已知即将插入自动增长列的行数,预留已知数量的值。
- 例如:“INSERT INTO table SELECT ...”和COPY FROM触发自增值无法获取即将插入的行数。ALTER TABLE命令表数据重写时,若触发自增,使用统计信息中的reltuples作为即将预留的行数。 “INSERT INTO table VALUES(...),(...),...”由于要分布到不同DN,在某些执行计划中,DN获取不到即将插入的行数。
- 若行数未知,每次预留2^n个值,例如,第一次自增预留1个值,第二次自增预留2个值,第三次预留4个值,第四次预留8个值,以此类推,若预留值个数超过65535,预留65535个值。
- 第一次触发自增时,若已知即将插入自动增长列的行数,预留已知数量的值。
- 参数值不为0时,预留缓存值的数量为参数值。
- 第一次触发自增时,若已知即将插入自动增长列的行数,预留已知数量的值。
- 若行数未知,每次预留auto_increment_cache数量的自增值。
默认值:0
设置方式:该参数属于USERSET类型参数,请参考表1中对应设置方法进行设置。
设置建议:推荐使用默认值,若默认情况产生自增值不连续的情况,可以根据用户即将批量插入数据量调整参数值。参数值越大,批量插入性能越优,也更可能产生不连续的自增值。
disable_keyword_options
参数说明:数据库兼容性行为配置项,该参数的值由若干个配置项用逗号隔开构成。设置该参数的标识符将不会作为关键字使用。
该参数属于USERSET类型参数,请参考表1中对应设置方法进行设置。
取值范围:字符串,支持设置以下关键字:auto_increment、change、charset、columns、compile、completion、containing、convert、csn、datetime、db4aishot、dbtimezone、discard_path、distributed、dumpfile、ends、entityescaping、escaped、evalname、event、events、expdp、gsiusable、gsivalid、gsiwaitall、finish、ilm_pidx_list、impdp、ifnull、invisible、json_object、lines、link、lnnvl、load_discard、locked、mark、nocache、noentityescaping、noextend、noscale、nvl2、ordinality、outfile、pivot、performance、public、recover、regexp_like、scale、schedule、separator、sessiontimezone、shrink、slave、specification、starting、starts、subpartitions、substr、unpivot、verify、visible、wellformed、xmltype、regexp、rlike、zerofill。
默认值:"datetime、regexp、rlike、zerofill"
![](https://support.huaweicloud.com/intl/zh-cn/distributed-devg-v8-gaussdb/public_sys-resources/note_3.0-zh-cn.png)
该参数打开后,作为关键字使用的部分功能会失效,请谨慎使用。
disable_plsql_keyword_options
参数说明:用于将设置的标识符当作非关键字使用。数据库兼容性行为配置项,该参数的值由若干个配置项用逗号隔开构成。
参数类型:字符串
参数单位:无
- PIPE
- PIPELINED
- RANGE
- REPLACE
- SUBTYPE
- ''
默认值:''
设置方式:该参数属于USERSET类型参数,请参考表1中对应设置方法进行设置
设置建议:无
![](https://support.huaweicloud.com/intl/zh-cn/distributed-devg-v8-gaussdb/public_sys-resources/note_3.0-zh-cn.png)
- 该参数打开后,作为关键字使用的部分功能会失效,请谨慎使用。
- 如需取消屏蔽plsql关键字功能,请将该参数设置为空值。
plpgsql.variable_conflict
参数说明:设置同名的存储过程变量和表的列的使用优先级。
该参数属于USERSET类型参数,仅支持表1中对应设置方法3进行设置。
取值范围:字符串
- error表示遇到存储过程变量和表的列名同名则编译报错。
- use_variable表示存储过程变量和表的列名同名则优先使用变量。
- use_column表示存储过程变量和表的列名同名则优先使用列名。
默认值:error
td_compatible_truncation
参数说明:控制是否开启与Teradata数据库相应兼容的特征。该参数在用户连接上与TD兼容的数据库时,可以将参数设置成为on(即超长字符串自动截断功能启用),该功能启用后,在后续的insert语句中,对目标表中char和varchar类型的列插入超长字符串时,会按照目标表中相应列定义的最大长度对超长字符串进行自动截断。保证数据都能插入目标表中,而不是报错。
![](https://support.huaweicloud.com/intl/zh-cn/distributed-devg-v8-gaussdb/public_sys-resources/note_3.0-zh-cn.png)
超长字符串自动截断功能不适用于insert语句包含外表的场景。
如果向字符集为字节类型编码(SQL_ASCII,LATIN1等)的数据库中插入多字节字符数据(如汉字等),且字符数据跨越截断位置,这种情况下,按照字节长度自动截断,自动截断后会在尾部产生非预期结果。如果用户有对于截断结果正确性的要求,建议用户采用UTF8等能够按照字符截断的输入字符集作为数据库的编码集。
该参数属于USERSET类型参数,请参考表1中对应设置方法进行设置。
取值范围:布尔型
- on表示启动超长字符串自动截断功能。
- off表示停止超长字符串自动截断功能。
默认值:off
nls_timestamp_format
参数说明:设置时间戳默认格式。
该参数属于USERSET类型参数,请参考表1中对应设置方法进行设置。
取值范围:字符串
默认值:DD-Mon-YYYY HH:MI:SS.FF AM
nls_timestamp_tz_format
参数说明:设置带时区时间戳默认格式。
该参数属于USERSET类型参数,请参考表1中对应设置方法进行设置。
取值范围:字符串,支持格式同nls_timestamp_format。
默认值:DD-Mon-YYYY HH:MI:SS.FF AM
![](https://support.huaweicloud.com/intl/zh-cn/distributed-devg-v8-gaussdb/public_sys-resources/note_3.0-zh-cn.png)
此参数在参数a_format_version值为10c和a_format_dev_version值为s1的情况下有效。
nls_nchar_characterset
参数说明:搭配nchr(cvalue int|bigint)系统函数使用,设置国家字符集,该参数的值为字符串枚举值。
参数类型:字符串
参数单位:无
取值范围:'AL16UTF16'和'UTF8',不区分大小写。
默认值:'AL16UTF16'
设置方式:该参数属于USERSET类型参数,请参见表1中对应设置方法进行设置。
设置建议:推荐使用默认值。
![](https://support.huaweicloud.com/intl/zh-cn/distributed-devg-v8-gaussdb/public_sys-resources/note_3.0-zh-cn.png)
- 数据库不支持国家字符集,该参数只是为了兼容ORA数据库,获取用户想使用的国家字符集。
- 该GUC参数仅限于nchr(cvalue int|bigint)函数的使用。
max_function_args
参数说明:函数参数最大个数。
该参数属于INTERNAL类型参数,为固定参数,用户无法修改此参数,只能查看。
取值范围:整型
默认值:8192
max_subpro_nested_layers
参数说明:嵌套子程序的最大嵌套深度。
参数类型:整型
参数单位:无
取值范围:0~100
![](https://support.huaweicloud.com/intl/zh-cn/distributed-devg-v8-gaussdb/public_sys-resources/note_3.0-zh-cn.png)
当设置为0时,不允许使用嵌套子程序。
默认值:3
设置方式:该参数属于USERSET类型参数,请参见表1中对应设置方法进行设置。
设置建议:根据最大嵌套情况设置。
convert_string_to_digit
参数说明:设置隐式转换优先级,是否优先将字符串转为数字。
该参数属于USERSET类型参数,请参考表1中对应设置方法进行设置。
取值范围:布尔型
- on表示优先将字符串转为数字。
- off表示不优先将字符串转为数字。
默认值:on
![](https://support.huaweicloud.com/intl/zh-cn/distributed-devg-v8-gaussdb/public_sys-resources/notice_3.0-zh-cn.png)
该参数调整会修改内部数据类型转换规则,导致不可预期的行为,请谨慎调操作。
enable_object_special_character
参数说明:控制执行CREATE EXTENSION语句时,若脚本文件中使用"@extschema@",此时control文件中schema参数的值是否可以包含["$'\]中任意特殊字符。
该参数属于SIGHUP类型参数,请参考表1中对应设置方法进行设置。
取值范围:布尔型
- on表示开启,可以包含["$'\]中任意特殊字符。
- off表示关闭,不可以包含["$'\]中任意特殊字符。
默认值:off
![](https://support.huaweicloud.com/intl/zh-cn/distributed-devg-v8-gaussdb/public_sys-resources/notice_3.0-zh-cn.png)
扩展功能为内部使用功能,不建议用户使用。
a_format_disable_func
参数说明:禁用指定的系统函数。该参数的值由若干个系统函数OID值用逗号隔开组成。设置该参数的系统函数将不能被调用。
当某一系统函数不能满足用户需求并且需要使用相同函数名的自定义函数时可使用该功能。
参数类型:字符串
参数单位:无
取值范围:字符串,由若干个系统函数OID值用逗号隔开组成。
数据库平台兼容性行为配置项 |
支持被禁用的系统函数 |
---|---|
10c,s1 |
anyarray array_extendnull(anyarray,int4,int4); -- funcoid: 6018 clob empty_clob(); -- funcoid: 3825 int4 instrb(text,text); -- funcoid: 3240 int4 instrb(text,text,int4); -- funcoid: 3241 int4 instrb(text,text,int4,int4); -- funcoid: 3242 numeric months_between(timestamp,timestamp); -- funcoid: 1522 timestamp round(timestamp); -- funcoid: 通过查询语句获取 select oid from pg_proc where proname='round' and pronamespace=11 and pronargs=1 and allargtypes[0]=1114; timestamp round(timestamp,text); -- funcoid: 4465 timestamp to_date(text,text,bool); -- funcoid: 1524 timestamp to_date(text,text,text,bool); -- funcoid: 1525 numeric to_number(text,text,bool); -- funcoid: 1787 numeric to_number(text,text,text,bool); -- funcoid: 1788 timestamp to_timestamp(text,text,bool); -- funcoid: 606 timestamp to_timestamp(text,text,text,bool); -- funcoid: 607 timestamptz to_timestamp_tz(text); -- funcoid: 1806 timestamptz to_timestamp_tz(text,text); -- funcoid: 1807 timestamptz to_timestamp_tz(text,text,bool); -- funcoid: 1808 timestamptz to_timestamp_tz(text,text,text,bool); -- funcoid: 1809 |
10c,s2 |
text DBTimezone(); -- funcoid: 5562 int8 ascii2(text); -- funcoid: 1625 text asciistr(text); -- funcoid: 1626 text asciistr(blob); -- funcoid: 1629 int4 bit2coding(text); -- funcoid: 9311 int4 bit4coding(text); -- funcoid: 9325 float8 cosh(float8); -- funcoid: 1548 numeric cosh(numeric); -- funcoid: 1549 timestamptz current_timestamp(numeric); -- funcoid: 3257 text dump(any); -- funcoid: 9086 text dump(any,int4); -- funcoid: 9088 text dump(any,int4,int4); -- funcoid: 9089 text dump(any,int4,int4,int4); -- funcoid: 9090 float4 nanvl(float4,float4); -- funcoid: 7112 float4 nanvl(float4,numeric); -- funcoid: 7115 float8 nanvl(float8,float8); -- funcoid: 7113 float4 nanvl(numeric,float4); -- funcoid: 7116 numeric nanvl(numeric,numeric); -- funcoid: 7114 timestamp new_time(timestamp,text,text); -- funcoid: 374 text nls_lower(text); -- funcoid: 4082 text nls_lower(text,text); -- funcoid: 4083 text nls_upper(text); -- funcoid: 4084 text nls_upper(text,text); -- funcoid: 4085 interval numtoyminterval(numeric,text); -- funcoid: 9333 int8 ora_hash(any); -- funcoid: 6127 int8 ora_hash(any,int8); -- funcoid: 6128 text rawtohex2(any); -- funcoid: 9540 numeric remainder(int8,int8); -- funcoid: 9767 numeric remainder(int2,int2); -- funcoid: 9765 numeric remainder(int4,int4); -- funcoid: 9766 float4 remainder(float4,float4); -- funcoid: 9771 float4 remainder(float4,numeric); -- funcoid: 9768 float8 remainder(float8,float8); -- funcoid: 9770 float4 remainder(numeric,float4); -- funcoid: 9769 numeric remainder(numeric,numeric); -- funcoid: 9761 numeric remainder(int1,int1); -- funcoid: 9764 text session_time_zone(); -- funcoid: 9571 float8 sinh(float8); -- funcoid: 1546 numeric sinh(numeric); -- funcoid: 1547 timestamp sys_extract_utc(timestamp); -- funcoid: 5258 timestamp sys_extract_utc(timestamptz); -- funcoid: 5259 float8 tanh(float8); -- funcoid: 9762 numeric tanh(numeric); -- funcoid: 9763 float8 to_binary_double(text); -- funcoid: 9669 float8 to_binary_double(text,text); -- funcoid: 9670 float8 to_binary_double(text,text,bool); -- funcoid: 9671 float8 to_binary_double(text,text,text,bool); -- funcoid: 9672 float4 to_binary_float(text); -- funcoid: 9673 float4 to_binary_float(text,text); -- funcoid: 9674 float4 to_binary_float(text,text,bool); -- funcoid: 9675 float4 to_binary_float(text,text,text,bool); -- funcoid: 9676 blob to_blob(any); -- funcoid: 6990 interval to_dsinterval(text); -- funcoid: 9126 interval to_dsinterval(text,text,bool); -- funcoid: 9127 text to_multi_byte(text); -- funcoid: 9537 text to_multi_byte(blob); -- funcoid: 9539 varchar to_nchar(int8); -- funcoid: 通过查询语句获取 select oid from pg_proc where proname='to_nchar' and pronamespace=11 and pronargs=1 and allargtypes[0]=20; varchar to_nchar(int2); -- funcoid: 通过查询语句获取 select oid from pg_proc where proname='to_nchar' and pronamespace=11 and pronargs=1 and allargtypes[0]=21; varchar to_nchar(int4); -- funcoid: 通过查询语句获取 select oid from pg_proc where proname='to_nchar' and pronamespace=11 and pronargs=1 and allargtypes[0]=23; text to_nchar(text); -- funcoid: 通过查询语句获取 select oid from pg_proc where proname='to_nchar' and pronamespace=11 and pronargs=1 and allargtypes[0]=25; varchar to_nchar(float4); -- funcoid: 通过查询语句获取 select oid from pg_proc where proname='to_nchar' and pronamespace=11 and pronargs=1 and allargtypes[0]=700; varchar to_nchar(float8); -- funcoid: 通过查询语句获取 select oid from pg_proc where proname='to_nchar' and pronamespace=11 and pronargs=1 and allargtypes[0]=701; varchar to_nchar(numeric); -- funcoid: 通过查询语句获取 select oid from pg_proc where proname='to_nchar' and pronamespace=11 and pronargs=1 and allargtypes[0]=1700; text to_nchar(timestamp); -- funcoid: 5698 text to_nchar(timestamptz); -- funcoid: 5699 text to_nchar(anyset); -- funcoid: 5700 text to_nchar(int8,text); -- funcoid: 5694 text to_nchar(int4,text); -- funcoid: 5693 text to_nchar(float4,text); -- funcoid: 5695 text to_nchar(float8,text); -- funcoid: 5696 text to_nchar(timestamp,text); -- funcoid: 5697 text to_nchar(timestamptz,text); -- funcoid: 5691 text to_nchar(interval,text); -- funcoid: 5690 text to_nchar(numeric,text); -- funcoid: 5692 text to_single_byte(text); -- funcoid: 9536 text to_single_byte(blob); -- funcoid: 9538 interval to_yminterval(text); -- funcoid: 9124 interval to_yminterval(text,text,bool); -- funcoid: 9125 text tz_offset(text); -- funcoid: 706 text unistr(text); -- funcoid: 9081 text unistr(blob); -- funcoid: 9082 int4 vsize(any); -- funcoid: 9083 |
10c,s4 |
clob getclobval(xml); -- funcoid: 8011 varchar getstringval(xml); -- funcoid: 6976 nvarchar2 nchr(int8); -- funcoid: 1694 timestamptz to_timestamp_tz(text,text,text); -- funcoid: 1804 timestamptz to_timestamp_tz(text,text,text,text,bool); -- funcoid: 1805 |
10c,s5 |
sys_guid();--funcoid:2974 |
默认值:''
设置方式:该参数属于SUSET类型参数,请参见18.2-表2 GUC参数设置方式中对应设置方法进行设置。
设置建议:数据库平台兼容性行为配置项(a_format_version,a_format_dev_version)未开启时其对应新增的系统函数默认不可用,无须使用该参数进行禁用。
enable_convert_illegal_char
参数说明:对输出结果中的非法编码是否设置不进行校验并以占位符替换显示。
参数类型:布尔型
参数单位:无
取值范围:
- on:表示开启,非法编码将替换为convert_illegal_char_mode参数指定符号的编码。
- off:表示关闭,查询结果中包含的非法编码会校验后报错。
默认值:off
设置方式:该参数属于USERSET类型参数,请参见表1中对应设置方法进行设置。
设置建议:设置为默认值,仅在数据中存在特殊字符且需要对特殊字符进行强制不报错处理时开启该参数。
![](https://support.huaweicloud.com/intl/zh-cn/distributed-devg-v8-gaussdb/public_sys-resources/note_3.0-zh-cn.png)
- 当数据库字符集为:utf8、zhs16gbk、gb18030、gb18030-2022、latin1时,enable_convert_illegal_char = on时生效,且在数据库客户端与服务端字符集不相同时,非法编码将以占位符形式显示。
- 特殊字符范围:本文所指的特殊字符范围仅包括完全编码异常和混合编码,不支持\u0000字符。若字符编码中包含\u0000字符,在使用时通常会在\u0000处截断,无法保证数据的完整性。
- 若数据库客户端与服务端字符集不相同,在enable_convert_illegal_char = off时,数据库将超出当前字符集编码外的特殊字符(不包含\x0000字符)替换为\x3F(即显示为?)编码写入数据库中;当enable_convert_illegal_char = on时,只能使用函数dbe_raw.cast_to_varchar2()将非法编码原编码插入数据库中,并以占位符形式显示。
- 当开启GUC参数时,特殊字符在下表所列的函数、高级包函数中的表现为:
- 在客户端与服务端字符集一致时:特殊字符在查询时不报错,与开启GUC参数前的行为保持一致。
- 在客户端与服务端字符集不一致时:特殊字符在查询时显示为占位符(默认为?)。
- 不建议客户使用函数处理包含特殊字符的字符串,下表所列函数处理包含特殊字符的字符串不会产生报错,但不保证结果的正确性。
序号 |
函数名/高级包函数名 |
---|---|
1 |
bit_length(string) |
2 |
btrim(string text [, characters text]) |
3 |
char_length(string) character_length(string) |
4 |
chr(cvalue int|bigint) chr(integer) |
5 |
concat(str1,str2) |
6 |
concat_ws(sep text, str"any" [, str"any" [, ...] ]) |
7 |
decode(string text, format text) |
8 |
dump(expr[, return_fmt [, start_position [, length ] ] ]) |
9 |
encode(data bytea, format text) |
10 |
find_in_set(text, set) |
11 |
format(formatstr text [, str"any" [, ...] ]) |
12 |
left(str text, n int) |
13 |
length(string) |
14 |
lengthb(text/bpchar) |
15 |
ltrim(string [, characters]) |
16 |
md5(string) |
17 |
notlike(x bytea name text, y bytea text) |
18 |
octet_length(string) |
19 |
overlay(string placing string FROM int [for int]) |
20 |
quote_ident(string text) |
21 |
quote_literal(string text) |
22 |
quote_nullable(string text) |
23 |
rawcat(raw,raw) |
24 |
regexp_count(string text, pattern text [, position int [, flags text]]) |
25 |
regexp_instr(string text, pattern text [, position int [, occurrence int [, return_opt int [, flags text]]]]) |
26 |
regexp_like(source_string, pattern [, match_parameter]) regexp_like(text,text,text) |
27 |
regexp_matches(string text, pattern text [, flags text]) |
28 |
regexp_replace(string, pattern, replacement [,flags ]) |
29 |
regexp_split_to_array(string text, pattern text [, flags text ]) |
30 |
regexp_split_to_table(string text, pattern text [, flags text]) |
31 |
regexp_substr(source_char, pattern) regexp_substr(string text, pattern text [, position int [, occurrence int [, flags text]]]) |
32 |
repeat(string text, number int ) |
33 |
repexp_replace(string text, pattern text [, replacement text [, position int [, occurrence int [, flags text]]]]) |
34 |
replace(string text, from text, to text) |
35 |
replace(string, substring) |
36 |
reverse(str) |
37 |
right(str text, n int) |
38 |
rtrim(string [, characters]) |
39 |
sha(string) |
40 |
sha1(string) |
41 |
sha2(string,hash_length) |
42 |
split_part(string text, delimiter text, field int) |
43 |
substring(string [from int] [for int]) substring(string from pattern for escape) substring(string from pattern) |
44 |
substring_inner(string [from int] [for int]) |
45 |
tconvert(key text, value text) |
46 |
to_single_byte(char) |
47 |
translate(string text, from text, to text) |
48 |
trim([leading |trailing |both] [characters] from string) |
49 |
unistr(string) |
50 |
vsize(expr) |
51 |
PKG_UTIL.RAW_CAST_FROM_VARCHAR2 |
52 |
PKG_UTIL.LOB_CONVERTTOCLOB |
53 |
PKG_UTIL.LOB_RAWTOTEXT |
54 |
PKG_UTIL.LOB_TEXTTORAW |
55 |
PKG_UTIL.RAW_CAST_TO_VARCHAR2 |
56 |
DBE_OUTPUT.PUT |
57 |
DBE_OUTPUT.PUT_LINE |
fix_func_selection
参数说明:是否优化函数匹配策略。
catlist顺序问题:当用户自定义函数与系统函数存在冲突,数据库系统在选择函数时,会受该系统函数在数据库系统中的注册顺序影响,从而导致选择函数结果不同。
参数类型:字符串
参数单位:无
取值范围:''、catlist。
- '':不进行优化,与505.1.0版本之前的版本保持一致。
- catlist :优化catlist顺序问题(对于非MySQL兼容模式进行优化,非MySQL兼容模式下始终优先选择系统函数并执行。MySQL兼容模式与505.1.0版本之前的版本保持一致,可能提示函数不唯一的错误,也可能选中系统函数进行执行)。
默认值:
- catlist:新安装的数据库的默认值
- '':505.1.0版本之前的数据库升级后的默认值
设置方式:该参数属于USERSET类型参数,请参见表2中对应设置方法进行设置。
gs_format_behavior_compat_options
参数说明:gs_format_behavior_compat_options用于选择GaussDB内部系统函数配置项。
参数类型:字符串
参数单位:无
取值范围:当前只支持表9中的兼容性配置项,当设置多个兼容性配置项时,相邻配置项之间用逗号隔开。
默认值:'sqrt_karatsuba'
兼容性配置项 |
兼容性行为控制 |
---|---|
'sqrt_karatsuba' |
|
'allow_textconcat_null' |
|
设置方式:该参数属于USERSET类型参数,请参考表2中对应设置方法进行设置。
设置建议:控制一些兼容性特性是否可用,若要更改,请在理解参数含义后谨慎操作,避免因误操作产生意料之外的风险。