Updated on 2024-05-31 GMT+08:00

System Functions

GaussDB is compatible with most MySQL system functions, but there are some differences. Only system functions in M-compatible mode can be used. System functions of the original GaussDB cannot be used in case of unexpected results. Currently, some system functions in GaussDB with the same names as those in MySQL are not supported in M-compatible mode. For some of them, the message indicating that they are not supported in M-compatible mode is displayed. Other functions still retain the behaviors of the original GaussDB system functions. Do not use these functions in case of unexpected results. The following table lists the functions with the same name.

Table 1 Same-name functions for which a message indicating that they are not supported in M-compatible mode is displayed

cot

isEmpty

json_append

json_array

json_array_append

json_array_insert

json_contains

json_contains_path

json_depth

json_extract

json_insert

json_keys

json_length

json_merge

json_merge_patch

json_merge_preserve

json_object

json_quote

json_remove

json_valid

json_replace

json_search

json_set

json_type

json_unquote

last_insert_id

md5

mod

octet_length

overlaps

point

radians

stddev_pop

stddev_samp

var_pop

var_samp

variance

lag

lead

-

Table 2 Same-name functions that retain the behaviors of the original GaussDB system functions in M-compatible mode

ceil

decode

encode

format

instr

position

round

stddev

regexp_instr

regexp_like

regexp_replace

regexp_substr

row_num

-

-

In M-compatible mode, system functions have the following common differences:

  1. The return value type of a system function is the same as that of MySQL only when the node type of the input parameter is Var (table data) or Const (constant input). In other cases (for example, the input parameter is a calculation expression or function expression), the return value type may be different from that of MySQL.
  2. When an aggregate function uses an expression such as another function, operator, or SELECT clause as the input parameter (for example, SELECT sum(abs(n)) FROM t;), the aggregate function cannot obtain the precision transferred by the input parameter expression. As a result, the precision of the function result is different from that of MySQL.