Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Locale and Formatting

Updated on 2024-06-03 GMT+08:00

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 declaration (ISO, Postgres, SQL, or German) and the input/output order of year/month/day (DMY, MDY, YMD, Euro, European, US, NonEuro, NonEuropean, or Default). 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.

Parameter type: string

Unit: none

Value range: combination of the output format declaration and the input/output order of year/month/day. (The two components can be set separately.)

  • Output format declaration: ISO, Postgres, SQL, or German
  • Input/Output order of year/month/day: DMY (Euro, European), MDY (US, NonEuro, NonEuropean), or YMD

Default value: "ISO, MDY"

NOTE:

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

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

Setting suggestion: The ISO format is recommended.

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.
  • a indicates the output that matches the numtodsinterval function. For details, see "SQL Reference > Functions and Operators > Date and Time Processing Functions and Operators > numtodsinterval" in Developer Guide.
NOTICE:

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

Default value: postgres

TimeZone

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

Parameter type: string

Unit: none

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

Default value: "PRC"

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

Setting suggestion: Retain the default value.

NOTE:

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

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. India, Australia, or Default.

Default value: Default

NOTE:

Default indicates an abbreviation that works in most of the world, which is applicable to most cases. There are also other abbreviations, such as 'Australia' and 'India' that can be defined for a particular installation. For other time zone abbreviations, you need to set them in the corresponding configuration files before creating the database.

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.

NOTE:
  • 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.

NOTE:
  • You can run the locale -a command to check the system-supported locales and the corresponding encodings, and select one as required. The sorting rules may vary according to OSs or versions of the same OS. When application services are logically migrated between these OSs, differences and changes in OS sorting rules may cause differences in database functions such as indexes, partitions, and sorting operators. For example, data result sets returned by a same range query statement are different, or query results returned by a same sorting query statement are different. The application service needs to check whether the service data contains related characters based on the locale differences released by the OS.
  • 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 database, you are advised to retain the default value of client_encoding. Modification to this parameter in the gaussdb.conf file (by using the gs_guc tool, for example) does not take effect.
  • client_encoding can be set to GB18030_2022. When client_encoding is set to gb18030_2022, ensure that the GB18030 character set supported by the client OS has been upgraded to version 2022.
  • If the encoding format of the database character set is UTF8, the encoding format of the region supported by the current system is GB18030, the GB18030 character set supported by the client OS has been upgraded to version 2022, and the database contains historical data stored before the GB18030 character set is upgraded, the following situations may occur:
    1. When client_encoding is set to gb18030, the character encoding of historical data in the UTF8 database returned to the client is the same as that before the client character set is upgraded. However, the font of 38 characters whose mapping changes during the character set upgrade is the same as that in version 2022.
    2. When client_encoding is set to gb18030_2022, the character encoding of historical data in the UTF8 database returned to the client are the same as that after the upgrade of the client character set and the font of characters are the same as that before the upgrade. This is because the versions of the GB18030 character set are not completely compatible, which may cause data inconsistency. Therefore, if the GB18030 character set needs to be upgraded on the client and historical data exists, you need to convert the historical data before the upgrade.
  • client_encoding can be set to ZHS16GBK. The following table lists the setting methods of server_encoding and client_encoding corresponding to all ways that ZHS16GBK, GB18030, and GB18030_2022 character sets can be transformed.

server_encoding

client_encoding

locale

Setting Method

zhs16gbk

utf8

utf8

The database automatically obtains the value of locale.

utf8

zhs16gbk

gbk

  • Users use gsql to manually set client_encoding to zhs16gbk.
  • When JDBC is used for connection, the URL parameter is used to set characterEncoding to zhs16gbk.

zhs16gbk

zhs16gbk

gbk

  • When gsql is used for connection, the database automatically obtains the value of locale. After internal processing, client_encoding is automatically set to zhs16gbk.
  • When JDBC is used for connection, the URL parameter is used to set characterEncoding to zhs16gbk.

zhs16gbk

gb18030

gb18030

  • When gsql is used for connection, the database automatically obtains the value of locale.
  • When JDBC is used for connection, the URL parameter is used to set characterEncoding to gb18030.

gb18030

zhs16gbk

gbk

  • gsql does not support this setting.
  • When JDBC is used for connection, the URL parameter is used to set characterEncoding to zhs16gbk.

zhs16gbk

gb18030-2022

gb18030

  • When gsql is used for connection, users can manually set client_encoding to gb18030_2022.
  • When JDBC is used for connection, the URL parameter is used to set characterEncoding to gb18030_2022.

gb18030-2022

zhs16gbk

gbk

  • gsql does not support this setting.
  • When JDBC is used for connection, the URL parameter is used to set characterEncoding to zhs16gbk.

gb18030

utf8

utf8

The database automatically obtains the value of locale.

utf8

gb18030

gb18030

  • The database automatically obtains the value of locale.
  • When JDBC is used for connection, the URL parameter is used to set characterEncoding to gb18030.

gb18030_2022

utf8

utf8

The database automatically obtains the value of locale.

utf8

gb18030_2022

gb18030

  • When gsql is used for connection, users can manually set client_encoding to gb18030_2022.
  • When JDBC is used for connection, the URL parameter is used to set characterEncoding to gb18030_2022.

gb18030

gb18030

gb18030

  • The database automatically obtains the value of locale.
  • When JDBC is used for connection, the URL parameter is used to set characterEncoding to gb18030.

gb18030_2022

gb18030_2022

gb18030

  • When gsql is used for connection, the database automatically obtains the value of locale. After internal processing, client_encoding is automatically set to gb18030_2022.
  • When JDBC is used for connection, the URL parameter is used to set characterEncoding to gb18030_2022.

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

NOTE:
  • 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

NOTE:
  • 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_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

NOTE:
  • 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_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

NOTE:
  • 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_time_names

Parameter description: Specifies the language used to display names and abbreviations of dates and months. The output of the DATE_FORMAT(), DAYNAME(), and MONTHNAME() functions is affected. The performance of STR_TO_DATE() and GET_FORMAT() is not affected.

Parameter type: string

Unit: none

Value range: IETF language tags in simple format, such as en_US or zh_CN.

Default value: en_US

Setting method: This is a USERSET parameter. Set it based on instructions provided in Setting GUC Parameters.

Setting suggestion: Switch the language based on service requirements.

default_week_format

Parameter description: Specifies the default mode value of the week() function. The following table lists the value range and description.

default_week_format

First Day of a Week

Range

First Week Definition

0

Sunday

0 to 53

The first week that contains a Sunday in this year.

1

Monday

0 to 53

The first week that contains four or more days in this year.

2

Sunday

1 to 53

The first week that contains a Sunday in this year.

3

Monday

1 to 53

The first week that contains four or more days in this year.

4

Sunday

0 to 53

The first week that contains four or more days in this year.

5

Monday

0 to 53

The first week that contains a Monday in this year.

6

Sunday

1 to 53

The first week that contains four or more days in this year.

7

Monday

1 to 53

The first week that contains a Monday in this year.

NOTE:

For week 1 of a year, the number 1 indicates a week number. The week number of the first week of a year may be 0, depending on the value of week_format, as shown in the third column.

Parameter type: integer

Unit: none

Value range: [0,7]

Default value: 0

Setting method: This is a USERSET parameter. Set it based on instructions provided in Setting GUC Parameters.

Setting suggestion: Select a mode based on service requirements.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback