diff --git a/content/docs-lite/en/docs/DataBaseReference/platform-and-client-compatibility.md b/content/docs-lite/en/docs/DataBaseReference/platform-and-client-compatibility.md index e439d610b1bd11ee738e921804e8150ed014a222..0e79610f6f6ea81d3aba465cb3500d5b9c559f08 100644 --- a/content/docs-lite/en/docs/DataBaseReference/platform-and-client-compatibility.md +++ b/content/docs-lite/en/docs/DataBaseReference/platform-and-client-compatibility.md @@ -28,6 +28,16 @@ This parameter is a USERSET parameter. Set it based on instructions provided in **Default value**: **DD-Mon-YYYY HH:MI:SS.FF AM** +## nls\_length\_semantics + +**Parameter description:**:Set the default semantics of the string type, set it to BYTE, calculate the string length by bytes, and set it to CHAR, calculate the string length by characters. + +This parameter is a USERSET parameter. Set it based on instructions provided in [Table 1](../DatabaseAdministrationGuide/resetting-parameters.md#en-us_topic_0283137176_en-us_topic_0237121562_en-us_topic_0059777490_t91a6f212010f4503b24d7943aed6d846). + +**Value range**:BYTE | CHAR + +**Default value**:BYTE + ## max\_function\_args **Parameter description**: Specifies the maximum number of parameters allowed for a function. diff --git a/content/docs-lite/en/docs/SQLReference/character-types.md b/content/docs-lite/en/docs/SQLReference/character-types.md index 5e740e3a522d1ad8470e6173009d5803e64f86ad..fb1a3454be94bbd8f25fafed4ef07c7701bff07f 100644 --- a/content/docs-lite/en/docs/SQLReference/character-types.md +++ b/content/docs-lite/en/docs/SQLReference/character-types.md @@ -13,26 +13,26 @@ -

CHAR(n)

-

CHARACTER(n)

-

NCHAR(n)

+

CHAR(n [BYTE|CHAR])

+

CHARACTER(n [BYTE|CHAR])

+

NCHAR(n [BYTE|CHAR])

-

Fixed-length character string, blank padded. n indicates the string length. If it is not specified, the default precision 1 is used.

+

Fixed-length character string, blank padded. n indicates the string length. If it is not specified, the default precision 1 is used. Use BYTE semantic default. If CHAR semantics are specified, n is the number of characters.

The maximum size is 10 MB.

-

VARCHAR(n)

-

CHARACTER VARYING(n)

+

VARCHAR(n [BYTE|CHAR])

+

CHARACTER VARYING(n [BYTE|CHAR])

-

Variable-length string. In PostgreSQL-compatible mode, n indicates the string length. In other compatibility modes, n indicates the byte length.

+

Variable-length string. In PostgreSQL-compatible mode, n indicates the string length. In other compatibility modes, n indicates the byte length. Use BYTE semantic default. If CHAR semantics are specified, n is the number of characters.

The maximum size is 10 MB.

-

VARCHAR2(n)

+

VARCHAR2(n [BYTE|CHAR])

-

Variable-length string. It is the alias of the VARCHAR(n) type. n indicates the string length.

+

Variable-length string. It is the alias of the VARCHAR(n) type. n indicates the string length. Use BYTE semantic default. If CHAR semantics are specified, n is the number of characters.

The maximum size is 10 MB.

diff --git a/content/docs-lite/en/docs/SQLReference/keywords.md b/content/docs-lite/en/docs/SQLReference/keywords.md index 160053db38e5e5580e4c0466b2c0a163cd6c40d8..2a3c4c2063dbec73f89fb0d0930ad255dc4c6d8c 100644 --- a/content/docs-lite/en/docs/SQLReference/keywords.md +++ b/content/docs-lite/en/docs/SQLReference/keywords.md @@ -610,6 +610,15 @@ The naming rules for identifiers are as follows:

Reserved

+

BYTE

+ +

Non-reserved

+ +

N/A

+ +

N/A

+ +

BYTEAWITHOUTORDER

Non-reserved (excluding functions and types)

diff --git "a/content/docs-lite/zh/docs/DatabaseReference/\345\271\263\345\217\260\345\222\214\345\256\242\346\210\267\347\253\257\345\205\274\345\256\271\346\200\247.md" "b/content/docs-lite/zh/docs/DatabaseReference/\345\271\263\345\217\260\345\222\214\345\256\242\346\210\267\347\253\257\345\205\274\345\256\271\346\200\247.md" index 3b9728f2090c1b293a06fff56d85716ab3351f03..82697d1ba069dd99f18d57f0249f80b378024966 100644 --- "a/content/docs-lite/zh/docs/DatabaseReference/\345\271\263\345\217\260\345\222\214\345\256\242\346\210\267\347\253\257\345\205\274\345\256\271\346\200\247.md" +++ "b/content/docs-lite/zh/docs/DatabaseReference/\345\271\263\345\217\260\345\222\214\345\256\242\346\210\267\347\253\257\345\205\274\345\256\271\346\200\247.md" @@ -28,6 +28,16 @@ **默认值**:DD-Mon-YYYY HH:MI:SS.FF AM +## nls\_length\_semantics + +**参数说明**:设置字符串类型的默认语义,设置为BYTE,按照字节计算字符串长度,设置为CHAR,按照字符计算字符串长度。 + +该参数属于USERSET类型参数,请参考[表1](重设参数.md#zh-cn_topic_0237121562_zh-cn_topic_0059777490_t91a6f212010f4503b24d7943aed6d846)中对应设置方法进行设置。 + +**取值范围**:BYTE | CHAR + +**默认值**:BYTE + ## group\_concat\_max\_len **参数说明**: 搭配函数GROUP\_CONCAT使用,限制其返回值长度,超长截断。 diff --git "a/content/docs-lite/zh/docs/SQLReference/\345\205\263\351\224\256\345\255\227.md" "b/content/docs-lite/zh/docs/SQLReference/\345\205\263\351\224\256\345\255\227.md" index a8419cf94bb68b30f13d5d80754ebfb34b7e1a4f..57ad96c2eda257d44b273671704c2eba088c136b 100644 --- "a/content/docs-lite/zh/docs/SQLReference/\345\205\263\351\224\256\345\255\227.md" +++ "b/content/docs-lite/zh/docs/SQLReference/\345\205\263\351\224\256\345\255\227.md" @@ -674,6 +674,15 @@ SQL里有保留字和非保留字之分。根据标准,保留字决不能用

保留

+

BYTE

+ +

非保留

+ +

-

+ +

-

+ +

BYTEAWITHOUTORDER

非保留(不能是函数或类型)

diff --git "a/content/docs-lite/zh/docs/SQLReference/\345\255\227\347\254\246\347\261\273\345\236\213.md" "b/content/docs-lite/zh/docs/SQLReference/\345\255\227\347\254\246\347\261\273\345\236\213.md" index b4c010a3a9b8fc148869455b822fb0d11ddf2d84..e425ef4ba904174f49338baebdfa10129e8f525a 100644 --- "a/content/docs-lite/zh/docs/SQLReference/\345\255\227\347\254\246\347\261\273\345\236\213.md" +++ "b/content/docs-lite/zh/docs/SQLReference/\345\255\227\347\254\246\347\261\273\345\236\213.md" @@ -13,26 +13,26 @@ openGauss支持的字符类型请参见[表1](#zh-cn_topic_0283136755_zh-cn_topi -

CHAR(n)

-

CHARACTER(n)

-

NCHAR(n)

+

CHAR(n [BYTE|CHAR])

+

CHARACTER(n [BYTE|CHAR])

+

NCHAR(n [BYTE|CHAR])

-

定长字符串,不足补空格。n是指字节长度,如不带精度n,默认精度为1。

+

定长字符串,不足补空格。默认是BYTE语义,n是字节长度,如指定CHAR语义,n是字符长度,如不带精度n,默认精度为1。

最大为10MB。

-

VARCHAR(n)

-

CHARACTER VARYING(n)

+

VARCHAR(n [BYTE|CHAR])

+

CHARACTER VARYING(n [BYTE|CHAR])

-

变长字符串。PG兼容模式下,n是字符长度。其他兼容模式下,n是指字节长度。

+

变长字符串。默认是BYTE语义,PG兼容模式下,n是字符长度。其他兼容模式下,n是指字节长度,如指定CHAR语义,n是字符长度。

最大为10MB。

-

VARCHAR2(n)

+

VARCHAR2(n [BYTE|CHAR])

-

变长字符串。是VARCHAR(n)类型的别名。n是指字节长度。

+

变长字符串。是VARCHAR(n)类型的别名。n是指字节长度,如指定CHAR语义,n是字符长度。

最大为10MB。

@@ -46,14 +46,14 @@ openGauss支持的字符类型请参见[表1](#zh-cn_topic_0283136755_zh-cn_topi

NVARCHAR2(n)

-

变长字符串。n是指字符长度。

+

变长字符串。n是指字符长度,如指定CHAR语义,n是字符长度。

最大为10MB。

TEXT

-

变长字符串。

+

变长字符串,默认是BYTE语义,PG兼容模式下,n是字符长度。其他兼容模式下,n是指字节长度,如指定CHAR语义,n是字符长度。

最大为1GB-1,但还需要考虑到列描述头信息的大小, 以及列所在元组的大小限制(也小于1GB-1),因此TEXT类型最大大小可能小于1GB-1。

diff --git a/content/en/docs/DatabaseReference/platform-and-client-compatibility.md b/content/en/docs/DatabaseReference/platform-and-client-compatibility.md index 75b283a8756d4604cf834fc3089f3454d6945a30..733a403fae4a57f58e0eba18cd3128c216d81f12 100644 --- a/content/en/docs/DatabaseReference/platform-and-client-compatibility.md +++ b/content/en/docs/DatabaseReference/platform-and-client-compatibility.md @@ -28,6 +28,16 @@ This parameter is a USERSET parameter. Set it based on instructions provided in **Default value**: **DD-Mon-YYYY HH:MI:SS.FF AM** +## nls\_length\_semantics + +**Parameter description:**:Set the default semantics of the string type, set it to BYTE, calculate the string length by bytes, and set it to CHAR, calculate the string length by characters. + +This parameter is a USERSET parameter. Set it based on instructions provided in [Table 1](../DatabaseAdministrationGuide/resetting-parameters.md#en-us_topic_0283137176_en-us_topic_0237121562_en-us_topic_0059777490_t91a6f212010f4503b24d7943aed6d846). + +**Value range**:BYTE | CHAR + +**Default value**:BYTE + ## max\_function\_args **Parameter description**: Specifies the maximum number of parameters allowed for a function. diff --git a/content/en/docs/SQLReference/character-types.md b/content/en/docs/SQLReference/character-types.md index d3be4476bf92cef7fb55ce1d2119d049f308af99..af5ce8aa4931e9ee125fce8e6fa1906905add76a 100644 --- a/content/en/docs/SQLReference/character-types.md +++ b/content/en/docs/SQLReference/character-types.md @@ -13,26 +13,26 @@ -

CHAR(n)

-

CHARACTER(n)

-

NCHAR(n)

+

CHAR(n [BYTE|CHAR])

+

CHARACTER(n [BYTE|CHAR])

+

NCHAR(n [BYTE|CHAR])

-

Fixed-length character string, blank padded. n indicates the string length. If it is not specified, the default precision 1 is used.

+

Fixed-length character string, blank padded. n indicates the string length. If it is not specified, the default precision 1 is used. Use BYTE semantic default. If CHAR semantics are specified, n is the number of characters.

The maximum size is 10 MB.

-

VARCHAR(n)

-

CHARACTER VARYING(n)

+

VARCHAR(n [BYTE|CHAR])

+

CHARACTER VARYING(n [BYTE|CHAR])

-

Variable-length string. In PostgreSQL-compatible mode, n indicates the string length. In other compatibility modes, n indicates the byte length.

+

Variable-length string. In PostgreSQL-compatible mode, n indicates the string length. In other compatibility modes, n indicates the byte length. Use BYTE semantic default. If CHAR semantics are specified, n is the number of characters.

The maximum size is 10 MB.

-

VARCHAR2(n)

+

VARCHAR2(n [BYTE|CHAR])

-

Variable-length string. It is the alias of the VARCHAR(n) type. n indicates the string length.

+

Variable-length string. It is the alias of the VARCHAR(n) type. n indicates the string length. Use BYTE semantic default. If CHAR semantics are specified, n is the number of characters.

The maximum size is 10 MB.

diff --git a/content/en/docs/SQLReference/keywords.md b/content/en/docs/SQLReference/keywords.md index 06fae9ad017dd5aa4acf05dc94ec3d549d32b2cb..2e1994efd2795aec15f1c3406571e677f59750f9 100644 --- a/content/en/docs/SQLReference/keywords.md +++ b/content/en/docs/SQLReference/keywords.md @@ -547,6 +547,15 @@ The naming rules for identifiers are as follows:

Reserved

+

BYTE

+ +

Non-reserved

+ +

N/A

+ +

N/A

+ +

BYTEAWITHOUTODER

Non-reserved (excluding functions and types)

diff --git "a/content/zh/docs/DatabaseReference/\345\271\263\345\217\260\345\222\214\345\256\242\346\210\267\347\253\257\345\205\274\345\256\271\346\200\247.md" "b/content/zh/docs/DatabaseReference/\345\271\263\345\217\260\345\222\214\345\256\242\346\210\267\347\253\257\345\205\274\345\256\271\346\200\247.md" index 1caa29439783d8fd6dd4e765a359eda4243e7d42..a0d6a5ceba316a4796e129ef652e68e3c006912d 100644 --- "a/content/zh/docs/DatabaseReference/\345\271\263\345\217\260\345\222\214\345\256\242\346\210\267\347\253\257\345\205\274\345\256\271\346\200\247.md" +++ "b/content/zh/docs/DatabaseReference/\345\271\263\345\217\260\345\222\214\345\256\242\346\210\267\347\253\257\345\205\274\345\256\271\346\200\247.md" @@ -28,6 +28,16 @@ **默认值**:DD-Mon-YYYY HH:MI:SS.FF AM +## nls\_length\_semantics + +**参数说明**:设置字符串类型的默认语义,设置为BYTE,按照字节计算字符串长度,设置为CHAR,按照字符计算字符串长度。 + +该参数属于USERSET类型参数,请参考[表1](重设参数.md#zh-cn_topic_0237121562_zh-cn_topic_0059777490_t91a6f212010f4503b24d7943aed6d846)中对应设置方法进行设置。 + +**取值范围**:BYTE | CHAR + +**默认值**:BYTE + ## group\_concat\_max\_len **参数说明**: 搭配函数GROUP\_CONCAT使用,限制其返回值长度,超长截断。 diff --git "a/content/zh/docs/SQLReference/\345\205\263\351\224\256\345\255\227.md" "b/content/zh/docs/SQLReference/\345\205\263\351\224\256\345\255\227.md" index 6690c4926d5105fcc3e8eec811b01545d41ef1b6..fdb61a74fe8b0c1bf182cebef61cabc34378c769 100644 --- "a/content/zh/docs/SQLReference/\345\205\263\351\224\256\345\255\227.md" +++ "b/content/zh/docs/SQLReference/\345\205\263\351\224\256\345\255\227.md" @@ -674,6 +674,15 @@ SQL里有保留字和非保留字之分。根据标准,保留字决不能用

保留

+

BYTE

+ +

非保留

+ +

-

+ +

-

+ +

BYTEAWITHOUTORDER

非保留(不能是函数或类型)

diff --git "a/content/zh/docs/SQLReference/\345\255\227\347\254\246\347\261\273\345\236\213.md" "b/content/zh/docs/SQLReference/\345\255\227\347\254\246\347\261\273\345\236\213.md" index c4f99130448403f6fc8afa2f0df7f7a6c8fa29b9..941f99368b30bbc34526c20a742fd80fe029386e 100644 --- "a/content/zh/docs/SQLReference/\345\255\227\347\254\246\347\261\273\345\236\213.md" +++ "b/content/zh/docs/SQLReference/\345\255\227\347\254\246\347\261\273\345\236\213.md" @@ -13,26 +13,26 @@ openGauss支持的字符类型请参见[表1](#zh-cn_topic_0283136755_zh-cn_topi -

CHAR(n)

-

CHARACTER(n)

-

NCHAR(n)

+

CHAR(n [BYTE|CHAR])

+

CHARACTER(n [BYTE|CHAR])

+

NCHAR(n [BYTE|CHAR])

-

定长字符串,不足补空格。n是指字节长度,如不带精度n,默认精度为1。

+

定长字符串,不足补空格。默认是BYTE语义,n是字节长度,如指定CHAR语义,n是字符长度,如不带精度n,默认精度为1。

最大为10MB。

-

VARCHAR(n)

-

CHARACTER VARYING(n)

+

VARCHAR(n [BYTE|CHAR])

+

CHARACTER VARYING(n [BYTE|CHAR])

-

变长字符串。PG兼容模式下,n是字符长度。其他兼容模式下,n是指字节长度。

+

变长字符串。默认是BYTE语义,PG兼容模式下,n是字符长度。其他兼容模式下,n是指字节长度,如指定CHAR语义,n是字符长度。

最大为10MB。

-

VARCHAR2(n)

+

VARCHAR2(n [BYTE|CHAR])

-

变长字符串。是VARCHAR(n)类型的别名。n是指字节长度。

+

变长字符串。是VARCHAR(n)类型的别名。默认是BYTE语义,n是字节长度,如指定CHAR语义,n是字符长度。

最大为10MB。

@@ -74,6 +74,7 @@ openGauss支持的字符类型请参见[表1](#zh-cn_topic_0283136755_zh-cn_topi > >1. 除了每列的大小限制以外,每个元组的总大小也不可超过1GB-1字节,主要受列的控制头信息、元组控制头信息以及元组中是否存在NULL字段等影响。 >2. NCHAR为bpchar类型的别名,NCHAR(n)为bpchar(n)类型的别名。 +>3. 当不指定字符串长度语义时默认是BYTE语义,可使用GUC参数nls_length_semantics设置长度的默认语义 在openGauss里另外还有两种定长字符类型。在[表2](#zh-cn_topic_0283136755_zh-cn_topic_0237121950_zh-cn_topic_0059777889_tf74658686f5e4d979adf0ac04769ea16)里显示。name类型只用在内部系统表中,作为存储标识符,不建议普通用户使用。该类型长度当前定为64字节(63可用字符加结束符)。类型“char”只用了一个字节的存储空间。他在系统内部主要用于系统表,主要作为简单化的枚举类型使用。