Keywords

The SQL contains reserved and non-reserved words. Standards require that reserved keywords not be used as other identifiers. Non-reserved keywords have special meanings only in a specific environment and can be used as identifiers in other environments.

The naming rules for identifiers are as follows:

  • An identifier name can only contain letters, underscores, digits (0-9), and dollar signs ($).

  • An identifier name must start with a letter (a to z) or an underscore (_).

    NOTE:

    • The naming rules are recommended but not mandatory.

    • In special cases, double quotation marks (") can be used to avoid special character errors.

Compared with the original openGauss, Dolphin modifies keywords as follows:

  1. MEDIUMINT is added as a non-reserved keyword.
  2. The keyword DATE can be used as a function.
  3. LAST_DAY is added as a reserved keyword to distinguish the original LAST_DAY function of openGauss from the LAST_DAY function of Dolphin at the syntax level.
  4. GET_FORMAT is added as a non-reserved keyword to identify the GET_FORMAT function in syntax.
  5. DAY_HOUR, DAY_MINUTE, DAY_SECOND, DAY_MICROSECOND, HOUR_MINUTE, HOUR_SECOND, HOUR_MICROSECOND, MINUTE_SECOND, MINUTE_MICROSECOND, and SECOND_MICROSECOND are added as non-reserved keywords for the EXTRACT function to identify the corresponding unit in syntax.

Table 1 SQL keywords

Keyword

openGauss

SQL:1999

SQL-92

FORMAT

Non-reserved (excluding functions and types)

-

-

IF

Non-reserved (excluding functions and types)

-

-

KEYS

Non-reserved

-

-

MEDIUMINT

Non-reserved (excluding functions and types)

-

-

SIGNED

Non-reserved (excluding functions and types)

-

-

UNSIGNED

Non-reserved (excluding functions and types)

-

-

ZEROFILL

Non-reserved

-

-

DATENon-reserved (excluding functions and types)--
LAST_DAYReserved--
GET_FORMATNon-reserved (excluding functions and types)--
DAY_HOURNon-reserved--
DAY_MINUTENon-reserved--
DAY_SECONDNon-reserved--
DAY_MICROSECONDNon-reserved--
HOUR_MINUTENon-reserved--
HOUR_SECONDNon-reserved--
HOUR_MICROSECONDNon-reserved--
MINUTE_SECONDNon-reserved--
MINUTE_MICROSECONDNon-reserved--
SECOND_MICROSECONDNon-reserved--
Feedback
编组 3备份
    openGauss 2024-10-11 00:55:40
    cancel