Platform and Client Compatibility
Many platforms use the database system. External compatibility of the database system provides a lot of convenience for platforms.
convert_string_to_digit
Parameter description: Specifies the implicit conversion priority, which determines whether to preferentially convert strings into numbers.
This parameter is a USERSET parameter. Set it based on instructions provided in Table 1.
Value range: Boolean
- on indicates that strings are preferentially converted into numbers.
- off indicates that strings are not preferentially converted into numbers.
Default value: on
Adjusting this parameter will change the internal data type conversion rule and cause unexpected behaviors. Exercise caution when performing this operation.
nls_timestamp_format
Parameter description: Specifies the default timestamp format.
This parameter is a USERSET parameter. Set it based on instructions provided in Table 1.
Value range: a string
Default value: DD-Mon-YYYY HH:MI:SS.FF AM
nls_timestamp_tz_format
Parameter description: Specifies the default timestamp with time zone format.
This parameter is a USERSET parameter. Set it based on instructions provided in Table 1.
Value range: a string. The supported formats are the same as those of nls_timestamp_format.
Default value: DD-Mon-YYYY HH:MI:SS.FF AM
This parameter is valid only when a_format_version is set to 10c and a_format_dev_version is set to s1.
group_concat_max_len
Parameter description: This parameter is used together with the GROUP_CONCAT function to limit the length of the return value. If the length exceeds the limit, the exceeded part of the return value is truncated.
This is a USERSET parameter. Set it based on instructions provided in Table 1.
Value range: 0 to 9223372036854775807
Default value: 1024
Currently, the maximum length that can be returned is 1073741823. If the length exceeds the limit, the out of memory error is reported.
max_function_args
Parameter description: Specifies the maximum number of parameters allowed for a function.
This parameter is a fixed INTERNAL parameter and cannot be modified.
Value range: an integer
Default value: 8192
transform_null_equals
Parameter description: Specifies whether expressions of the form expr = NULL (or NULL = expr) are treated as expr IS NULL. They return true if expr evaluates to the NULL value, and false otherwise.
- The correct SQL-standard-compliant behavior of expr = NULL is to always return NULL (unknown).
- Filtered forms in Microsoft Access generate queries that appear to use expr = NULL to test for null values. If you enable this option, you can use this interface to access the database.
This parameter is a USERSET parameter. Set it based on instructions provided in Table 1.
Value range: Boolean
- on indicates that expressions of the form expr = NULL (or NULL = expr) are treated as expr IS NULL.
- off indicates that expr = NULL always returns NULL (unknown).
Default value: off
New users are always confused about the semantics of expressions involving NULL values. Therefore, off is used as the default value.
support_extended_features
Parameter description: Specifies whether extended database features are supported.
This parameter is a POSTMASTER parameter. Set it based on instructions provided in Table 1.
Value range: Boolean
- on indicates that extended database features are supported.
- off indicates that extended database features are not supported.
Default value: off
enable_extension
Parameter description: Specifies whether to support the creation of database extensions.
This parameter is a USERSET parameter. Set it based on instructions provided in Table 1.
Value range: Boolean
- on indicates that the creation of database extensions is supported.
- off indicates that the creation of database extensions is not supported.
Default value: off
The extension function is for internal use only. You are not advised to use it.
sql_compatibility
Parameter description: Specifies the type of mainstream database with which the SQL syntax and statement behavior of the database is compatible. This parameter is an INTERNAL parameter. It can be viewed but cannot be modified.
Value range: enumerated type
- A indicates that the database is compatible with the Oracle database.
- B indicates that the database is compatible with the MySQL database.
- C indicates that the database is compatible with the Teradata database.
- PG indicates that the database is compatible with the PostgreSQL database.
Default value: A
- This parameter can be set only when you run the CREATE DATABASE command to create a database. For details, see "SQL Reference > SQL Syntax > CREATE DATABASE" in the Developer Guide.
- In the database, this parameter must be set to a specific value. It can be set to A or B and cannot be changed. Otherwise, the setting is not consistent with the database behavior.
b_format_behavior_compat_options
Parameter description: Specifies a B-compatible database configuration item. Multiple items are separated by commas (,).
This parameter is a USERSET parameter. Set it based on instructions provided in Table 1.
Value range: a string
Default value: ""
- Currently, only B-compatible configuration items listed in Table 1 are supported.
- Multiple items are separated by commas (,), for example, set b_format_behavior_compat_options='enable_set_variables,set_session_transaction';.
Item |
Behavior |
---|---|
enable_set_variables |
Indicates whether to enable the enhancement of the SET syntax.
|
set_session_transaction |
Indicates whether to enable the SET SESSION TRANSACTION syntax.
|
enable_modify_column |
Indicates whether to enable the ALTER TABLE MODIFY syntax.
|
default_collation |
Indicates whether to enable forward compatibility of the default collation.
|
behavior_compat_options
Parameter description: Specifies database compatibility behavior. Multiple items are separated by commas (,).
This parameter is a USERSET parameter. Set it based on instructions provided in Table 1.
Value range: a string
Default value: ""
- Currently, only items in Table 2 are supported.
- Multiple items are separated by commas (,), for example, set behavior_compat_options='end_month_calculate,display_leading_zero';.
Configuration Item |
Behavior |
||||
---|---|---|---|---|---|
display_leading_zero |
Specifies how floating-point numbers are displayed. It controls the display of zeros before the decimal point of all character string types (such as char, character, nchar, varchar, character varying, varchar2, nvarchar2, text, and clob) and any precision types (such as float4, float8, and numeric) in the numeric type. In addition, the length of the calculated number is displayed synchronously.
|
||||
end_month_calculate |
Specifies the calculation logic of the add_months function. Assume that the two parameters of the add_months function are param1 and param2, and that the month of param1 and param2 is result.
|
||||
compat_analyze_sample |
Specifies the sampling behavior of the ANALYZE operation. If this item is specified, the sample collected by the ANALYZE operation will be limited to around 30,000 records, controlling database node memory consumption and maintaining the stability of ANALYZE. |
||||
bind_schema_tablespace |
Binds a schema with the tablespace with the same name. If a tablespace name is the same as sche_name, default_tablespace will also be set to sche_name if search_path is set to sche_name. |
||||
bind_procedure_searchpath |
Specifies the search path of the database object in a stored procedure for which no schema name is specified. If no schema name is specified for a stored procedure, the search is performed in the schema to which the stored procedure belongs. If the stored procedure is not found, the following operations are performed:
|
||||
correct_to_number |
Specifies the compatibility of the to_number() result. If this item is not set, the result of the to_number() function is the same as that in the A database by default.
If this item is set, the result of the to_number() function is the same as that of pg11.
|
||||
unbind_divide_bound |
Specifies the range check on the result of integer division. If this item is not set, the range of the division result is verified. For example, an out-of-bounds error is reported because the output result of INT_MIN/(–1) is greater than INT_MAX.
If this item is set, the range of the division result does not need to be verified. For example, the output result of INT_MIN/(–1) is INT_MAX+1.
|
||||
convert_string_digit_to_numeric |
Determines whether to convert numeric constants of the character string type to those of the numeric type before these two types are compared.
|
||||
return_null_string |
Specifies how to display the empty result (empty string '') of the lpad() and rpad() functions.
|
||||
compat_concat_variadic |
Specifies the compatibility of variadic results of the concat() and concat_ws() functions. The B database does not have the variadic type. Therefore, this option has no impact on the B database. If this item is not set and the concat function parameter is of the variadic type, the results of the A and C databases in compatibility mode are the same by default.
If this item is set and the concat function parameter is of the variadic type, different result formats of the A and C databases in compatibility mode are retained.
|
||||
merge_update_multi |
When MERGE INTO ... WHEN MATCHED THEN UPDATE (see "SQL Reference" > "SQL Syntax" > "MERGE INTO" in Developer Guide) and INSERT ... ON DUPLICATE KEY UPDATE (see "SQL Reference" > "SQL Syntax" > "INSERT" in Developer Guide) are used, it controls the UPDATE behavior if a piece of target data in the target table conflicts with multiple pieces of source data. If this item is specified and the preceding scenario exists, the system performs multiple UPDATE operations on the conflicting row. Otherwise, an error is reported by default, that is, the MERGE or INSERT operation fails. |
||||
plstmt_implicit_savepoint |
Determines whether the execution of an UPDATE statement in a stored procedure has an independent subtransaction. If this parameter is set, the implicit savepoint is enabled before executing each UPDATE statement in the stored procedure, and the subtransaction is rolled backed to the latest savepoint in the EXCEPTION block by default, ensuring that only the modification of failed statements is rolled back. This option is used to be compatible with the EXCEPTION behavior of the O database. |
||||
hide_tailing_zero |
Configuration item for numeric display. If this parameter is not set, numeric data is displayed in the specified precision. If this parameter is set, the trailing zeros after the decimal point are hidden in all scenarios where numeric values are output, even if the precision format is specified. 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) |
||||
rownum_type_compat |
Specifies the ROWNUM type. The default value is BIGINT. After this parameter is specified, the value is changed to NUMERIC. gaussdb=# set behavior_compat_options=''; gaussdb=# create table tb_test(c1 int,c2 varchar2,c3 varchar2); gaussdb=# insert into tb_test values(1,'a','b'); gaussdb=# create or replace view v_test as select rownum from tb_test; gaussdb=# \d+ v_test View "public.v_test" Column | Type | Modifiers | Storage | Description --------+--------+-----------+---------+------------- rownum | bigint | | plain | View definition: SELECT ROWNUM AS "rownum" FROM tb_test; gaussdb=# set behavior_compat_options = 'rownum_type_compat'; gaussdb=# create or replace view v_test1 as select rownum from tb_test; gaussdb=# \d+ v_test1 View "public.v_test1" Column | Type | Modifiers | Storage | Description --------+---------+-----------+---------+------------- rownum | numeric | | main | View definition: SELECT ROWNUM AS "rownum" FROM tb_test; |
||||
aformat_null_test |
Specifies the logic for checking whether rowtype is not null. When this parameter is set, if one column in a row is not empty, true is returned for checking whether rowtype is not null. When this parameter is not set, if all columns in a row are not empty, true is returned for checking whether rowtype is not null. This parameter has no influence on checking whether rowtype is not null. gaussdb=# set behavior_compat_options='aformat_null_test'; gaussdb=# select r, r is null as isnull, r is not null as isnotnull from (values (1,row(1,2)), (1,row(null,null)), (1,null), (null,row(1,2)), (null,row(null,null)), (null,null) ) r(a,b); r | isnull | isnotnull -------------+--------+----------- (1,"(1,2)") | f | t (1,"(,)") | f | t (1,) | f | t (,"(1,2)") | f | t (,"(,)") | f | t (,) | t | f (6 rows) gaussdb=# set behavior_compat_options=''; gaussdb=# select r, r is null as isnull, r is not null as isnotnull from (values (1,row(1,2)), (1,row(null,null)), (1,null), (null,row(1,2)), (null,row(null,null)), (null,null) ) r(a,b); r | isnull | isnotnull -------------+--------+----------- (1,"(1,2)") | f | t (1,"(,)") | f | t (1,) | f | f (,"(1,2)") | f | f (,"(,)") | f | f (,) | t | f (6 rows) |
||||
aformat_regexp_match |
Determines the matching behavior of regular expression functions.
When this parameter is set and sql_compatibility is set to A or B, the options supported by the flags parameter of the regular expression are changed as follows:
Otherwise, the meanings of the options supported by the flags parameter of the regular expression are as follows:
|
||||
compat_cursor |
Determines the compatibility behavior of implicit cursor states. If this parameter is set and the O compatibility mode is used, the effective scope of implicit cursor states (SQL%FOUND, SQL%NOTFOUND, SQL%ISOPNE, and SQL%ROWCOUNT) is extended from only the currently executed function to all subfunctions invoked by this function. |
||||
proc_outparam_override |
Determines the overloading of output parameters of a stored procedure. After this parameter is enabled, the stored procedure can be properly created and invoked even if only the output parameters of the stored procedure are different. Currently, this parameter can be used only when gsql and JDBC are used to connect to the database. If this parameter is enabled for other tools to connect to the database, stored procedures with the out parameter cannot be invoked. It supports the functions that contain the out output parameter and returns data of the record type. Besides, a value is assigned to the out parameter. |
||||
proc_implicit_for_loop_variable |
Controls the behavior of the FOR_LOOP query statement in a stored procedure. When this parameter is set, if rec has been defined in the FOR rec IN query LOOP statement, the defined rec variable is not reused and a new variable is created. Otherwise, the defined rec variable is reused and no variable is created. |
||||
allow_procedure_compile_check |
Controls the compilation check of the SELECT and OPEN CURSOR statements in a stored procedure. If this parameter is set, when the SELECT, OPEN CURSOR FOR, CURSOR%rowtype, or FOR rec IN statement is executed in a stored procedure, the stored procedure cannot be created if the queried table does not exist, and the compilation check of the trigger function is not supported. If the queried table exists, the stored procedure is successfully created. Note: When creating an encrypted function, you need to disable allow_procedure_compile_check. |
||||
char_coerce_compat |
Controls the behavior when char(n) types are converted to other variable-length string types. If this parameter is not set, spaces at the end are omitted when the char(n) type is converted to other variable-length string types. If this parameter is set, spaces at the end are not omitted during conversion. In addition, if the length of the char(n) type exceeds the length of other variable-length string types, an error is reported. This parameter is valid only when the sql_compatibility parameter is set to A. After this parameter is enabled, spaces at the end are not omitted in implicit conversion, explicit conversion, or conversion by calling the text(bpchar) function. 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 |
Configuration item for numeric display. If this parameter is not set, numeric data is displayed in the default precision. When this parameter is set, the trailing zeros after the decimal point are hidden in all numeric output scenarios except to_char(numeric, format). For example: 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) |
||||
plsql_security_definer |
After this parameter is enabled, the definer permission is used by default when a stored procedure is created. |
||||
plpgsql_dependency |
If this parameter is set, a function, stored procedure, or package containing undefined objects can be created. You can query the dependency in GS_DEPENDENCIES and GS_DEPENDENCIES_OBJ. If this parameter is enabled, when creating a PL/SQL object, the OID that depends on the PL/SQL object is automatically updated.
Dependency can be established in the following scenarios:
Dependency cannot be established in the following scenarios:
Notes:
|
||||
disable_rewrite_nesttable |
If this parameter is enabled, rewriting of columns related to the tableof type in the pg_type table will be disabled. That is, when reading the pg_type table, the actual stored value of the tableof type is displayed. |
||||
skip_insert_gs_source |
If this parameter is enabled, data is not inserted into the dbe_pldeveloper.gs_source table when the PL/SQL objects are created. |
||||
disable_emptystr2null |
If this parameter is enabled, the function of converting empty strings to null by default is disabled for the following character types: text, clob, blob, raw, bytea, varchar, nvarchar2, bpchar, char, name, byteawithoutorderwithqualcol, and byteawithoutordercol. This parameter is reserved for emergency. Do not set it unless necessary. |
||||
select_into_return_null |
This parameter takes effect only in PG-compatible mode. If this parameter is enabled, a NULL value can be assigned to the variables in the stored procedure statement SELECT select_expressions INTO [STRICT] target FROM... without specifying STRICT when the query result is empty. |
||||
proc_uncheck_default_param |
When a function is called, the system does not check whether the default parameter is omitted.
|
||||
dynamic_sql_compat |
After this parameter is enabled, the dynamic statement does not consider the template parameters with the same name in the template SQL statement as the same variable. Instead, the variables in the USING clause are matched in sequence.
CAUTION:
|
||||
dynamic_sql_check |
If this parameter is enabled, an error is reported during dynamic statement execution if the number of different template parameters in the dynamic statement template SQL is different from the number of variables in the USING clause.
CAUTION:
|
||||
enable_funcname_with_argsname |
If the parameter is enabled, the projection alias displays the complete function when the SELECT function is invoked.
|
||||
allow_rownum_alias |
After this parameter is enabled, ROWNUM can be used as a column alias in SQL statements using the AS syntax. ROWNUM is used as a common identifier and cannot be used as a pseudocolumn.
WARNING:
You are not advised to change the status of this parameter during service execution. When the parameter is enabled, database objects (such as table names, column names, and database names) created using ROWNUM as the name in the database can be used only when the parameter is enabled. Otherwise, ambiguity occurs and the behavior is unpredictable. When the parameter is disabled, the behavior of using ROWNUM as a pseudocolumn in the database becomes invalid after the parameter is enabled and the behavior is unpredictable. |
||||
current_sysdate |
If this parameter is enabled, the current OS time is returned when the sysdate command is executed. gaussdb=# set behavior_compat_options='current_sysdate'; SET gaussdb=# select sysdate; current_sysdate --------------------- 2023-06-20 20:15:27 (1 row) |
plsql_compile_check_options
Parameter description: Specifies database compatibility behavior. Multiple items are separated by commas (,).
This parameter is a USERSET parameter. Set it based on instructions provided in Table 1.
Value range: a string
Default value: ""
- Currently, only items in Table 2 are supported.
- Multiple items are separated by commas (,), for example, set plsql_compile_check_options='for_loop,outparam';.
Configuration Item |
Behavior |
---|---|
for_loop |
Determines the behavior of the FOR_LOOP query statement in a stored procedure. When this parameter is set, if rec has been defined in the FOR rec IN query LOOP statement, the defined rec variable is not reused and a new variable is created. Otherwise, the defined rec variable is reused and no new variable is created. (It is the same as proc_implicit_for_loop_variable and will be incorporated later.) |
outparam |
When the output parameter overloading condition is met, the output parameters are checked. If the output parameters are constant, an error is reported. |
plsql_expression_check |
When the compilation check mode and this parameter are enabled, the output parameter type is checked additionally. If a value cannot be assigned for the output parameter, a warning is reported. |
a_format_version
Parameter description: Specifies the database platform compatibility configuration item. The value of this parameter is an enumerated string.
This parameter is a USERSET parameter. Set it based on instructions provided in Table 1.
Value range: a string
Default value: ""
- Currently, only items in Table 2 are supported.
- Set a character string for the compatibility configuration item, for example, set a_format_version='10c'.
Configuration Item |
Behavior |
---|---|
10c |
Compatible version of platform A |
a_format_dev_version
Parameter description: Specifies the database platform minor version compatibility configuration item. The value of this parameter is an enumerated string.
This parameter is a USERSET parameter. Set it based on instructions provided in Table 1.
Value range: a string
Default value: ""
- Currently, only items in Table 5 are supported.
- Set a character string for the compatibility configuration item, for example, set a_format_dev_version='s1'.
Configuration Item |
Behavior |
---|---|
s1 |
|
s2 |
|
plpgsql.variable_conflict
Parameter description: Sets the priority of using stored procedure variables and table columns with the same name.
This is a USERSET parameter. Set it based on instructions provided in Table 1.
Value range: a string
- error indicates that a compilation error is reported when the name of a stored procedure variable is the same as that of a table column.
- use_variable indicates that if the name of a stored procedure variable is the same as that of a table column, the variable is used preferentially.
- use_column indicates that if the name of a stored procedure variable is the same as that of a table column, the column name is used preferentially.
Default value: error
td_compatible_truncation
Parameter description: Specifies whether to enable features compatible with a Teradata database. You can set this parameter to on when connecting to a database compatible with the Teradata database, so that when you perform the INSERT operation, overlong strings are truncated based on the allowed maximum length before being inserted into char- and varchar-type columns in the target table. This ensures all data is inserted into the target table without errors reported.
The string truncation function cannot be used if the INSERT statement includes a foreign table.
If inserting multi-byte character data (such as Chinese characters) to database with the character set byte encoding (such as SQL_ASCII or LATIN1), and the character data crosses the truncation position, the string is truncated based on its bytes instead of characters. Unexpected result will occur in tail after the truncation. If you want correct truncation result, you are advised to adopt encoding set such as UTF8, which has no character data crossing the truncation position.
This parameter is a USERSET parameter. Set it based on instructions provided in Table 1.
Value range: Boolean
- on indicates that overlong strings are truncated.
- off indicates that overlong strings are not truncated.
Default value: off
uppercase_attribute_name
Parameter description: Specifies whether to return column names in uppercase to the client. This parameter is used only in the ORA-compatible mode and centralized environment.
This parameter is a USERSET parameter. Set it based on instructions provided in Table 1.
Value range: Boolean
- on indicates that column names are returned to the client in uppercase.
- off indicates that column names are not returned to the client in uppercase.
Default value: off
lastval_supported
Parameter description: Specifies whether the lastval function can be used.
This parameter is a POSTMASTER parameter. Set it based on instructions provided in Table 1.
Value range: Boolean
- on indicates that the lastval function can be used and the nextval function cannot be pushed down.
- off indicates that the lastval function cannot be used and the nextval function can be pushed down.
Default value: off
a_format_copy_version
Parameter description: Specifies the database platform minor version compatibility configuration item. The value of this parameter is an enumerated string.
This parameter is a USERSET parameter. Set it based on instructions provided in Table 1. When using gs_loader to import new features, you need to set the corresponding values.
Value range: a string
Default value: ''.
- Currently, only items in Table 6 are supported.
- Supports setting character string for compatibility configuration. For details, see section "Client Tools > gs_loader" in Tool Reference. You can set the a_format_copy_version parameter by using guc_param.
Configuration Item |
Behavior |
---|---|
s1 |
|
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot