Updated on 2026-11-09 GMT+08:00

Locale and Formatting

The display format, time zone, character encoding, and currency and numeric locale formats vary depending on service scenarios. A unified format setting helps ensure the accuracy and readability of data display. This section describes GUC parameters related to the display format, including DateStyle, IntervalStyle, TimeZone, client_encoding, and lc_*.

Parameter Description

Table 1 Locale and formatting parameters

Parameter

Type

Description

DateStyle

String

Definition: Specifies the display format for date and time values, and the rules for interpreting ambiguous date input values. This parameter consists of two independent parts: the output format model (ISO, Postgres, SQL, or German) and the input/output order of year/month/day (DMY, MDY, or YMD). The two parts can be set separately or together. The keywords Euro and European are synonyms for DMY. The keywords US, NonEuro, and NonEuropean are synonyms for MDY.

The ISO format is recommended. Postgres, SQL, and German use abbreviations to represent time zones, such as EST, WST, and CST.

NOTE:

gs_initdb initializes this parameter to the same value as that of lc_time.

Range: A string.

Default Value: ISO, MDY.

IntervalStyle

Enum

Definition: Specifies the display format of interval values.

Range: Enumerated values.

  • sql_standard generates output compliant with the SQL standard.
  • postgres indicates that the output is formatted to match PostgreSQL 8.4 when the DateStyle parameter is set to ISO.
  • postgres_verbose indicates that the output is formatted to match PostgreSQL 8.4 when the DateStyle parameter is set to non_ISO.
  • iso_8601 indicates that the output is formatted to match the "format and code" defined in ISO 8601.
  • oracle outputs results corresponding to the numtodsinterval function in Oracle databases. Refer to numtodsinterval for details.
    NOTE:

    The IntervalStyle parameter also affects the interpretation of ambiguous interval input.

Default Value: postgres.

TimeZone

String

Definition: Specifies the time zone used for displaying and interpreting time stamps.

Range: A string.

Default Value: GMT.

timezone_abbreviations

String

Definition

Specifies the list of time zone abbreviations that are accepted by the server.

Range: A string.

Default Value: Default.

NOTE:

Default indicates the abbreviation for the general time zone. However, there are other abbreviations such as 'Australia' and 'India' that are used to define specific installations.

extra_float_digits

Integer

Definition: Specifies the number of digits displayed for floating-point values, including float4, float8, and geometric data types. The parameter value is added to the standard number of digits (FLT_DIG or DBL_DIG as appropriate).

Range: -15 to 3.

NOTE:
  • Setting it to 3 includes some significant data bits. This is particularly useful for dumping floating-point data that needs precise restoration.
  • Setting it to a negative value discards insignificant data bits.

Default Value: 0.

client_encoding

String

Definition: Specifies the character encoding type on the client. Set this parameter based on the frontend services. Keeping the client and server encodings consistent improves efficiency.

Range: All character encoding types compatible with PostgreSQL. UTF8 indicates that the database's character encoding type is used.

NOTE:
  • Run the locale -a command to view the locales and corresponding encoding formats supported by the current system and configure accordingly.
  • By default, gs_initdb initializes this parameter based on the current system environment. You can run the locale command to view the current configuration environment.
  • You are advised to keep the default value. Do not modify the client_encoding parameter directly in postgresql.conf using tools like gs_guc, as changes will not take effect to maintain consistent internal communication encoding.

Default Value: UTF8.

lc_monetary

String

Definition: Specifies the display format for monetary values. It affects the output of functions such as to_char. Acceptable values are system-dependent.

Range: A string.

NOTE:
  • Run the locale -a command to view the locales and corresponding encoding formats supported by the current system and configure accordingly.
  • By default, gs_initdb initializes this parameter based on the current system environment. You can run the locale command to view the current configuration environment.

Default Value: en_US.UTF-8.

lc_numeric

String

Definition

Specifies the display format for numbers. It affects the output of functions such as to_char. Acceptable values are system-dependent.

Range: A string.

NOTE:
  • Run the locale -a command to view the locales and corresponding encoding formats supported by the current system and configure accordingly.
  • By default, gs_initdb initializes this parameter based on the current system environment. You can run the locale command to view the current configuration environment.

Default Value: en_US.UTF-8.

lc_time

String

Definition: Specifies the display format of time and region. It affects the output of functions such as to_char. Acceptable values are system-dependent.

Range: A string.

NOTE:
  • Run the locale -a command to view the locales and corresponding encoding formats supported by the current system and configure accordingly.
  • By default, gs_initdb initializes this parameter based on the current system environment. You can run the locale command to view the current configuration environment.

Default Value: en_US.UTF-8.