Help Center/ GaussDB/ Developer Guide(Distributed_V2.0-8.x)/ FAQs/ What Is the Relationship Between an Empty String and NULL?
Updated on 2025-05-29 GMT+08:00

What Is the Relationship Between an Empty String and NULL?

Answer: Whether an empty string in GaussDB is NULL depends on the compatibility mode of the database.

  • A null string is judged as NULL in ORA-compatible mode.
    gaussdb=# CREATE DATABASE db_test1 DBCOMPATIBILITY = 'ORA';
    gaussdb=# \c db_test1
    db_test1=# SELECT '' IS NULL;
     ?column? 
    ----------
     t
    (1 row)
  • A null string is not judged as NULL in MySQL-compatible mode.
    gaussdb=# CREATE DATABASE db_test2 DBCOMPATIBILITY = 'MYSQL';
    gaussdb=# \c db_test2
    db_test2=# SELECT '' IS NULL;
     ?column? 
    ----------
     f
    (1 row)