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

Locale and Formatting

This section describes parameters related to the time format setting.

DateStyle

Parameter description: Specifies the display format for date and time values, as well as the rules for interpreting ambiguous date input values.

This variable contains two independent components: the output format specifications (ISO, Postgres, SQL, or German) and the input/output order of year/month/day (DMY, MDY, or YMD). The two components 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.

This is a USERSET parameter. Set it based on instructions provided in Table 1.

Value range: a string

Default value: 'ISO, MDY'

gs_initdb will initialize this parameter so that its value is the same as that of lc_time.

If this parameter is modified by running the gs_guc reload command and the connection of a session on the current node is not from the client but from another node in the cluster to which the node belongs, this parameter does not take effect immediately on the session after the gs_guc reload command is executed. The setting takes effect only after the connection node is disconnected and then reconnected.

Setting Suggestions: The ISO format is recommended. Postgres, SQL, and German use abbreviations for time zones, such as EST, WST, and CST. These abbreviations can be ambiguous. For example, CST can represent Central Standard Time (USA) UT-6:00, Central Standard Time (Australia) UT+9:30, and China Standard Time UT+8:00. This may lead to incorrect time zone conversion and cause errors.

IntervalStyle

Parameter description: Specifies the display format for interval values.

This is a USERSET parameter. Set it based on instructions provided in Table 1.

Value range: enumerated values

  • sql_standard indicates that output matching SQL standards will be generated.
  • postgres indicates that output matching PostgreSQL 8.4 will be generated when the DateStyle parameter is set to ISO.
  • postgres_verbose indicates that output matching PostgreSQL 8.4 will be generated when the DateStyle parameter is set to non_ISO.
  • iso_8601 indicates that output matching the time interval "format with designators" defined in ISO 8601 will be generated.
  • oracle indicates the output that matches the numtodsinterval function in the Oracle database. For details, see "SQL Reference > Functions and Operators > Date and Time Processing Functions and Operators > numtodsinterval" in Developer Guide.

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

If this parameter is modified by running the gs_guc reload command and the connection of a session on the current node is not from the client but from another node in the cluster to which the node belongs, this parameter does not take effect immediately on the session after the gs_guc reload command is executed. The setting takes effect only after the connection node is disconnected and then reconnected.

Default value: postgres

TimeZone

Parameter description: Specifies the time zone for displaying and interpreting timestamps.

This is a USERSET parameter. Set it based on instructions provided in Table 1.

Value range: a string. You can query the PG_TIMEZONE_NAMES view to obtain the value. For details, see section "System Catalogs and System Views > System Views > PG_TIMEZONE_NAMES" in Developer Guide.

Default value:

gs_initdb will set a time zone value that is consistent with the system environment.

If this parameter is modified by running the gs_guc reload command and the connection of a session on the current node is not from the client but from another node in the cluster to which the node belongs, this parameter does not take effect immediately on the session after the gs_guc reload command is executed. The setting takes effect only after the connection node is disconnected and then reconnected.

timezone_abbreviations

Parameter description: Specifies the time zone abbreviations that will be accepted by the server.

This is a USERSET parameter. Set it based on instructions provided in Table 1.

Value range: a string. You can obtain it by querying the pg_timezone_names view.

Default value: Default

Default indicates abbreviations that work in most of the world. There are also other abbreviations, such as Australia and India that can be defined for a particular installation.

extra_float_digits

Parameter description: Adjusts 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).

This is a USERSET parameter. Set it based on instructions provided in Table 1.

Value range: an integer ranging from –15 to 3

  • This parameter can be set to 3 to include partially-significant digits. It is especially useful for dumping float data that needs to be restored exactly.
  • This parameter can also be set to a negative value to suppress unwanted digits.

Default value: 0

client_encoding

Parameter description: Specifies the client-side encoding (character set).

Set this parameter based on the situation of the front-end services. Try to keep the encoding consistent on the client and server to improve efficiency.

This is a USERSET parameter. Set it based on instructions provided in Table 1.

Value range: encoding compatible with PostgreSQL. UTF8 indicates that the database encoding is used.

  • You can run the locale -a command to check the system-supported locales and the corresponding encodings, and select one as required.
  • By default, gs_initdb will initialize the setting of this parameter based on the current system environment. You can also run the locale command to check the current configuration environment.
  • To use consistent encoding for communication within the cluster, you are advised to retain the default value of client_encoding. Modification to this parameter in the postgresql.conf file (by using the gs_guc tool, for example) does not take effect.

Default value: UTF8

Recommended value: SQL_ASCII or UTF8

lc_messages

Parameter description: Specifies the language in which messages are displayed.

  • Acceptable values are system-related.
  • On some systems, this locale category does not exist. Setting this variable will still work, but there will be no effect. In addition, translated messages for the desired language may not exist. In this case, you can still see the English messages.

    This is a SUSET parameter. Set it based on instructions provided in Table 1.

Value range: a string

  • You can run the locale -a command to check the system-supported locales and the corresponding encodings, and select one as required.
  • By default, gs_initdb will initialize the setting of this parameter based on the current system environment. You can also run the locale command to check the current configuration environment.

Default value: C

lc_monetary

Parameter description: Specifies the display format of monetary values. It affects the output of functions such as to_char. Acceptable values are system-related.

This is a USERSET parameter. Set it based on instructions provided in Table 1.

Value range: a string

  • You can run the locale -a command to check the system-supported locales and the corresponding encodings, and select one as required.
  • By default, gs_initdb will initialize the setting of this parameter based on the current system environment. You can also run the locale command to check the current configuration environment.
  • If this parameter is modified by running the gs_guc reload command and the connection of a session on the current node is not from the client but from another node in the cluster to which the node belongs, this parameter does not take effect immediately on the session after the gs_guc reload command is executed. The setting takes effect only after the connection node is disconnected and then reconnected.

Default value: C

lc_numeric

Parameter description: Specifies the display format of numbers. It affects the output of functions such as to_char. Acceptable values are system-related.

This is a USERSET parameter. Set it based on instructions provided in Table 1.

Value range: a string

  • You can run the locale -a command to check the system-supported locales and the corresponding encodings, and select one as required.
  • By default, gs_initdb will initialize the setting of this parameter based on the current system environment. You can also run the locale command to check the current configuration environment.
  • If this parameter is modified by running the gs_guc reload command and the connection of a session on the current node is not from the client but from another node in the cluster to which the node belongs, this parameter does not take effect immediately on the session after the gs_guc reload command is executed. The setting takes effect only after the connection node is disconnected and then reconnected.

Default value: C

lc_time

Parameter description: Specifies the display format of time and locale. It affects the output of functions such as to_char. Acceptable values are system-related.

This is a USERSET parameter. Set it based on instructions provided in Table 1.

Value range: a string

  • You can run the locale -a command to check the system-supported locales and the corresponding encodings, and select one as required.
  • By default, gs_initdb will initialize the setting of this parameter based on the current system environment. You can also run the locale command to check the current configuration environment.
  • If this parameter is modified by running the gs_guc reload command and the connection of a session on the current node is not from the client but from another node in the cluster to which the node belongs, this parameter does not take effect immediately on the session after the gs_guc reload command is executed. The setting takes effect only after the connection node is disconnected and then reconnected.

Default value: C

default_text_search_config

Parameter description: Specifies the text search configuration.

If the specified text search configuration does not exist, an error will be reported. If the specified text search configuration is deleted, set default_text_search_config again. Otherwise, an error will be reported, indicating incorrect configuration.

  • The text search configuration is used by text search functions that do not have an explicit argument specifying the configuration.
  • When a configuration file matching the environment is determined, gs_initdb will initialize the configuration file with a setting that corresponds to the environment.

    This is a USERSET parameter. Set it based on instructions provided in Table 1.

Value range: a string

GaussDB supports the following two configurations: pg_catalog.english and pg_catalog.simple.

Default value: pg_catalog.english