Updated on 2025-10-23 GMT+08:00

Other Functions

ATTNAME_EQ_MYSQL

attname_eq_mysql(name1, name2)

Description: Returns true if name1 is equal to name2 (case-insensitive). Otherwise, returns false.

Return type: Boolean

Example:

1
2
3
4
5
m_db=# SELECT attname_eq_mysql('abc', 'ABC');
 attname_eq_mysql 
------------------
 t
(1 row)

DATABASE

DATEBASE()

Description: Returns the name of the current database (schema).

Return value type: TEXT

Examples:

m_db=# SELECT DATABASE();
 database 
----------
 public
(1 row)

SCHEMA

SCHEMA()

Description: Returns the name of the current schema (database).

Return value type: TEXT

Examples:

m_db=# SELECT SCHEMA();
 schema
--------
 public
(1 row)

UUID

UUID()

Description: Returns a universally unique identifier (UUID) defined in RFC 4122, ISO/IEF 9834-8:2005, and related standards. The identifier is a string consisting of lowercase hexadecimal digits. The string consists of a group of 8-bit digits, three groups of 4-bit digits, and a group of 12-bit digits. A total of 32 digits represent 128 bits.

Return value type: VARCHAR

Examples:

m_db=# SELECT UUID();
                 uuid                 
--------------------------------------
 b28d6aaa-7a3a-c03c-f812-fa163e6cc336
(1 row)

UUID_SHORT

UUID_SHORT()

Description: Returns a short UUID under certain conditions. This identifier is a 64-bit unsigned integer.

The returned value is unique when the following conditions are met:

  • The number of service nodes in the current cluster cannot exceed 256.
  • You cannot set the system time of the server host between node restarts.
  • The average number of UUID_SHORT() calls per second between node restarts is less than 16 million.

Return value type: UINT64

Examples:

1
2
3
4
5
m_db=# SELECT UUID_SHORT();
      uuid_short      
----------------------
 13863614461119561729
(1 row)