From cf1fe690a08408ec3ee72cd84d99d26cebe94c3f Mon Sep 17 00:00:00 2001 From: dwordge Date: Thu, 20 Mar 2025 15:11:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AD=97=E7=AC=A6=E4=B8=B2?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E9=95=BF=E5=BA=A6=E8=AF=AD=E4=B9=89=E7=9A=84?= =?UTF-8?q?=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../platform-and-client-compatibility.md | 10 +++++++++ .../en/docs/SQLReference/character-types.md | 18 +++++++-------- .../en/docs/SQLReference/keywords.md | 9 ++++++++ ...57\345\205\274\345\256\271\346\200\247.md" | 10 +++++++++ .../\345\205\263\351\224\256\345\255\227.md" | 9 ++++++++ ...27\347\254\246\347\261\273\345\236\213.md" | 22 +++++++++---------- .../platform-and-client-compatibility.md | 10 +++++++++ .../en/docs/SQLReference/character-types.md | 18 +++++++-------- content/en/docs/SQLReference/keywords.md | 9 ++++++++ ...57\345\205\274\345\256\271\346\200\247.md" | 10 +++++++++ .../\345\205\263\351\224\256\345\255\227.md" | 9 ++++++++ ...27\347\254\246\347\261\273\345\236\213.md" | 19 ++++++++-------- 12 files changed, 115 insertions(+), 38 deletions(-) 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 e439d610b..0e79610f6 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 5e740e3a5..fb1a3454b 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 160053db3..2a3c4c206 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 3b9728f20..82697d1ba 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 a8419cf94..57ad96c2e 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 b4c010a3a..e425ef4ba 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 75b283a87..733a403fa 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 d3be4476b..af5ce8aa4 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 06fae9ad0..2e1994efd 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 1caa29439..a0d6a5ceb 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 6690c4926..fdb61a74f 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 c4f991304..941f99368 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”只用了一个字节的存储空间。他在系统内部主要用于系统表,主要作为简单化的枚举类型使用。 -- Gitee