Updated on 2025-07-22 GMT+08:00

GaussDB(DWS) Database Object Naming Rules

The name of a database object must contain 1 to 63 characters, start with a letter or underscore (_), and can contain letters, digits, underscores (_), and dollar signs ($). If the database uses GBK, UTF8, or SQL_ASCII, object names can include Chinese characters. With UTF8 or SQL_ASCII, each Chinese character counts as three, with a limit of 21 characters. With GBK, each Chinese character counts as two, with a limit of 31 characters. The Latin1 character set does not support Chinese characters. The character set format is specified during database creation. For details, see CREATE DATABASE.

  • [Proposal] Do not use reserved or non-reserved keywords to name database objects.

    You can use SELECT * FROM pg_get_keywords () to obtain GaussDB(DWS) keywords. For other ways to obtain the keywords, see Keywords in the SQL Syntax Reference.

  • [Proposal] Do not use strings enclosed in double quotation marks to define database object names. In GaussDB(DWS), double quotation marks are used to specify that the enclosed database object names are case sensitive. Case sensitivity of database object names makes problem location difficult.
  • [Proposal] Use the same naming format for database objects.
    • In a system undergoing incremental development or service migration, you are advised to comply with its historical naming conventions.
    • A database object name consists of letters, digits, and underscores (_); and cannot start with a digit. You are advised to use multiple words separated with hyphens (-).
    • You are advised to use intelligible names and common acronyms or abbreviations for database objects. Acronyms or abbreviations that are generally understood are recommended. For example, you can use English words indicating actual business terms. The naming format should be consistent within a cluster.
    • A variable name must be descriptive and meaningful. It must have a prefix indicating its type.
  • [Proposal] The name of a table object should indicate its main characteristics, for example, whether it is an ordinary, temporary, or unlogged table.
    • An ordinary table name should indicate the business relevant to a data set.
    • Temporary tables are named in the format of tmp_Suffix.
    • Unlogged tables are named in the format of ul_Suffix.
    • Foreign tables are named in the format of f_Suffix.