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

Database Object Naming Guidelines

  • The name of a database object must contain up to 63 characters, start with a letter or underscore (_), and can contain letters, digits, underscores (_), dollar signs ($), and number signs (#).
  • Do not use reserved or non-reserved keywords to name database objects.

    Run the following command to view the keywords:

    SELECT * FROM pg_get_keywords();

  • Do not use a string enclosed in double quotation marks ("") to define the database object name, unless you need to specify its capitalization.

    By default, GaussDB is case insensitive for object names in SQL statements. If two different tables (t_Table and t_table) exist in the same database, use double quotation marks (""). Otherwise, avoid using double quotation marks (""). Case sensitivity of database object names makes problem location difficult.

  • The naming style of database objects must be consistent. Lowercase letters are recommended.

    In a system undergoing incremental development or service migration, comply with its historical naming conventions.

    Use multiple words separated with underscores (_).

    Use intelligible names and common acronyms or abbreviations for database objects. Acronyms or abbreviations that are generally understood are recommended, for example, use English words or Chinese pinyin indicating actual business terms. The naming format should be consistent within a DB instance.

    A variable name must be descriptive and meaningful. It must have a prefix indicating its type.

    Table 1 Naming rules of database objects

    Object Type



    Length Restriction

    (Unit: Byte)


    Database name





    Common table





    Temporary table




    For example, an intermediate table used by operation personnel for temporary backup or data collection.

    Naming rule: tmp_Table name abbreviation_Creator account abbreviation_Creation date, for example, tmp_user_ytw_160505.

    Primary key




    If the table name is too long, use the abbreviation of the table name. Use the universal abbreviation or the abbreviation without vowels.

    UNIQUE constraint




    Unique index, which is named uk_.

    If the table name or field name is too long, use the abbreviation of the table name or field name. Use the universal abbreviation or the abbreviation without vowels.






    Table field




    Use meaningful English words or abbreviations to name fields.

    For example, a field of the bool type is named in the format of is_Description. A column whose member status is enabled in the member table is named is_enabled.