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
NOTICE: 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_length_semantics
Parameter description::Set the default semantics of the string type, set it to BYTE, calculate the string length by bytes, and set it to CHAR, calculate the string length by characters.
This parameter is a USERSET parameter. Set it based on instructions provided in Table 1.
Value range:BYTE | CHAR
Default value:BYTE
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 turn this option on, you can use this interface to access the database.
This parameter is a USERSET parameter. Set it based on instructions provided in Table 2.
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
NOTE: 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 2.
Value range: Boolean
- on indicates that extended database features are supported.
- off indicates that extended database features are not supported.
Default value: off
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
NOTICE:
- This parameter can be set only by dbcompatibility when you run the CREATE DATABASE command to create a database.
- In the database, this parameter must be set to a specific value. It can be set to A or B and cannot be changed randomly. Otherwise, the setting is not consistent with the database behavior.
enable_set_variable_b_format
Parameter description: Specifies whether the function of customizing user variables is supported in the MY-compatible database.
This parameter is a USERSET parameter. Set it based on instructions provided in Table 1.
Value range: Boolean
- on indicates that user variables can be customized in the MY-compatible database.
- off indicates that user variables cannot be customized in the MY-compatible database.
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: ""
NOTE:
- Currently, only compatibility configuration items in Table 1 are supported.
- Multiple items are separated by commas (,), for example, set behavior_compat_options='end_month_calculate,display_leading_zero';.
Table 1 Compatibility configuration items
Specifies how floating point numbers are displayed.
| |
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.
openGauss=# select add_months('2018-02-28',3) from sys_dummy;
add_months
---------------------
2018-05-28 00:00:00
(1 row)
openGauss=# select add_months('2018-02-28',3) from sys_dummy;
add_months
---------------------
2018-05-31 00:00:00
(1 row) | |
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. | |
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. | |
Specifies the search path of the database object 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: | |
Specifies the compatibility of the to_number() result. If this item is specified, the result of the to_number() function is the same as that of PG11. Otherwise, the result is the same as that of the O database. | |
Specifies the range check on the result of integer division. If this item is specified, you do not need to check the range of the division result. For example, the result of INT_MIN/(-1) can be INT_MAX+1. If this item is not specified, an out-of-bounds error is reported because the result is greater than INT_MAX. | |
Determines whether to convert columns of the character string type to those of the numeric type before columns of these two types are compared. | |
Specifies how to display the empty result (empty string '') of the lpad() and rpad() functions. openGauss=# select length(lpad('123',0,'*')) from sys_dummy; length --------
openGauss=# select length(lpad('123',0,'*')) from sys_dummy; length | |
Specifies the compatibility of variadic results of the concat() and concat_ws() functions. If this item is specified and a concat function has a parameter of the variadic type, different result formats in A database and Teradata are retained. If this item is not specified and a concat function has a parameter of the variadic type, same result formats in A database and Teradata are retained, and the results are the same as those in A database. This option has no effect on MY because MY has no variadic type. | |
When MERGE INTO... WHEN MATCHED THEN UPDATE (see MERGE INTO) and INSERT... ON DUPLICATE KEY UPDATE (see INSERT) are used, control 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. If this item is not specified and the preceding scenario exists, an error is reported, that is, the MERGE or INSERT operation fails. | |
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. | |
Configuration item for numeric display. If this parameter is not set, numeric data is displayed in the specified precision. When setting this parameter, hide 0 at the end of the decimal place. set behavior_compat_options='hide_tailing_zero'; select cast(123.123 as numeric(15,10)); numeric --------- 123.123 (1 row) | |
Specifies the ROWNUM type. The default value is INT8. After this parameter is specified, the value is changed to NUMERIC. | |
Determines the logic for checking whether the row type is not null. When this parameter is set, if a column in a row is not null, true is returned. When this parameter is not set, if all columns in a row are not null, true is returned. | |
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:
| |
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) are extended only the currently executed function to all subfunctions invoked by this function. | |
Determines the reloading of output parameters of a stored procedure. After this parameter is enabled, the stored procedure can be properly invoked even if only the output parameters of the stored procedure are different. | |
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. | |
Determines 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. | |
Determines the behavior when char(n) types are converted to other variable-length string types. By default, spaces at the end are omitted when the char(n) type is converted to other variable-length string types. After this parameter is enabled, 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 sql_compatibility is set to A. | |
Controls the performance of substr(str, from, for) in different scenarios. By default, if the value of from is less than 0, substr counts from the end of the string. If the value of for is less than 1, substr returns NULL. After this parameter is enabled, if the value of from is less than 0, substr counts from the first (-from + 1) bit of the character string. If the value of for is less than 0, substr reports an error. This parameter is valid only when **sql_compatibility** is set to **PG**. | |
Prohibit inserting virtual columns. After enabling this option will prohibit to use record type variables as insertion values in insert statements.
create table t1(col1 varchar(10),col varchar(10));
create table t2(col1 varchar(10),col varchar(10));
set behavior_compat_options='disable_record_type_in_dml';
insert into t1 values('one','two');
declare
cursor cur1 is select * from t1;
source cur1%rowtype:=('ten','wtu');
begin
for source in cur1
loop
raise notice '%',source;
insert into t2 values(source);
end loop;
end;
/
ERROR: The record type variable cannot be used as an insertion value.
CONTEXT: SQL statement "insert into t2 values(source)"
PL/pgSQL function inline_code_block line 7 at SQL statement
|
plpgsql.variable_conflict
Parameter description: Sets the priority of using stored procedure variables and table columns with the same name.
This parameter is a USERSET parameter. Set it based on instructions provided in Table 2.
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.
NOTE: 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 2.
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 2.
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