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.
cot |
isEmpty |
last_insert_id |
mod |
octet_length |
overlaps |
point |
radians |
regexp_instr |
regexp_like |
regexp_replace |
regexp_substr |
stddev_pop |
stddev_samp |
var_pop |
var_samp |
variance |
- |
- |
- |
ceil |
decode |
encode |
format |
instr |
position |
round |
stddev |
row_num |
- |
- MySQL allows you to add user-defined functions to the database through the loadable functions. When such functions are called, aliases can be specified in the input parameters of the functions. GaussDB does not support loadable functions. When a function is called, aliases cannot be specified for input parameters of the function.
- In M-compatible mode, system functions have the following common differences:
- 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.
- 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.
- Calling system functions by pg_catalog.func_name() is not recommended. If the called function has input parameters in the format of syntax (such as SELECT substr('demo' from 1 for 2)), an error may occur when the function is called.
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