From 5583b362f61db83f985a802988fb0dad40c1b3f2 Mon Sep 17 00:00:00 2001 From: wangpingyun <2418191738@qq.com> Date: Wed, 26 Feb 2025 10:57:58 +0800 Subject: [PATCH] =?UTF-8?q?D=E5=85=BC=E5=AE=B9=E6=80=A7=E5=B8=B8=E7=94=A8?= =?UTF-8?q?=E8=AF=AD=E6=B3=95=E8=A1=A5=E5=85=85PART1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...71\350\261\241\345\221\275\345\220\215.md" | 1 + .../ExtensionReference/shark-CREATE-INDEX.md | 12 ++++- .../docs/ExtensionReference/shark-DELETE.md | 47 +++++++++++++++++ ...02\346\225\260\350\257\264\346\230\216.md" | 20 ++++++++ .../docs/ExtensionReference/shark-INSERT.md | 26 ++++++++++ .../shark-SQL\350\257\255\346\263\225.md" | 4 ++ .../docs/ExtensionReference/shark-UPDATE.md | 50 +++++++++++++++++++ ...k-\345\205\263\351\224\256\345\255\227.md" | 45 ++++++++++------- ...16\345\255\227\347\254\246\345\272\217.md" | 4 +- ...71\350\261\241\345\221\275\345\220\215.md" | 1 + .../ExtensionReference/shark-CREATE-INDEX.md | 12 ++++- .../docs/ExtensionReference/shark-DELETE.md | 47 +++++++++++++++++ ...02\346\225\260\350\257\264\346\230\216.md" | 20 ++++++++ .../docs/ExtensionReference/shark-INSERT.md | 26 ++++++++++ .../shark-SQL\350\257\255\346\263\225.md" | 4 ++ .../docs/ExtensionReference/shark-UPDATE.md | 50 +++++++++++++++++++ ...k-\345\205\263\351\224\256\345\255\227.md" | 45 ++++++++++------- ...16\345\255\227\347\254\246\345\272\217.md" | 6 +-- 18 files changed, 377 insertions(+), 43 deletions(-) create mode 100644 content/docs-lite/zh/docs/ExtensionReference/shark-DELETE.md create mode 100644 "content/docs-lite/zh/docs/ExtensionReference/shark-GUC\345\217\202\346\225\260\350\257\264\346\230\216.md" create mode 100644 content/docs-lite/zh/docs/ExtensionReference/shark-INSERT.md create mode 100644 content/docs-lite/zh/docs/ExtensionReference/shark-UPDATE.md create mode 100644 content/zh/docs/ExtensionReference/shark-DELETE.md create mode 100644 "content/zh/docs/ExtensionReference/shark-GUC\345\217\202\346\225\260\350\257\264\346\230\216.md" create mode 100644 content/zh/docs/ExtensionReference/shark-INSERT.md create mode 100644 content/zh/docs/ExtensionReference/shark-UPDATE.md diff --git "a/content/docs-lite/zh/docs/DeveloperGuide/\346\225\260\346\215\256\345\272\223\345\257\271\350\261\241\345\221\275\345\220\215.md" "b/content/docs-lite/zh/docs/DeveloperGuide/\346\225\260\346\215\256\345\272\223\345\257\271\350\261\241\345\221\275\345\220\215.md" index bc22e0c0d..c2d4b11b4 100644 --- "a/content/docs-lite/zh/docs/DeveloperGuide/\346\225\260\346\215\256\345\272\223\345\257\271\350\261\241\345\221\275\345\220\215.md" +++ "b/content/docs-lite/zh/docs/DeveloperGuide/\346\225\260\346\215\256\345\272\223\345\257\271\350\261\241\345\221\275\345\220\215.md" @@ -5,6 +5,7 @@ - 标识符非时序表长度不超过63个字节,时序表(当前特性是实验室特性,使用时请联系华为工程师提供技术支持)长度不超过53个字符。 - 标识符以字母或下划线开头,中间字符可以是字母、数字、下划线、$、#。 - 若标识符被双引号("")包含,则可以使用合法字符的任意组合,如"123gs_column"。 +- 在D兼容性下设置d_format_behavior_compat_options = 'enable_sbr_identifier',若标识符被中括号([])包含,则可以使用合法字符的任意组合,如"123gs_column"。创建用户名对象不能包含'\\'。 - 标识符不区分大小写,只有被双引号包含才区分大小写。 - 【建议】避免使用保留或者非保留关键字命名数据库对象。 diff --git a/content/docs-lite/zh/docs/ExtensionReference/shark-CREATE-INDEX.md b/content/docs-lite/zh/docs/ExtensionReference/shark-CREATE-INDEX.md index 350936e54..8c73c98c0 100644 --- a/content/docs-lite/zh/docs/ExtensionReference/shark-CREATE-INDEX.md +++ b/content/docs-lite/zh/docs/ExtensionReference/shark-CREATE-INDEX.md @@ -25,7 +25,7 @@ - 在表上创建索引。 ``` - CREATE [ UNIQUE ] [COLUMNSTORE] INDEX [ CONCURRENTLY ] [ [schema_name.]index_name ] ON table_name [ USING method ] + CREATE [ UNIQUE ] [ opt_clustered ] [COLUMNSTORE] INDEX [ CONCURRENTLY ] [ [schema_name.]index_name ] ON table_name [ USING method ] ({ { column_name [ ( length ) ] | ( expression ) } [ COLLATE collation ] [ opclass ] [ ASC | DESC ] [ NULLS { FIRST | LAST } ] }[, ...] ) [ INCLUDE ( column_name [, ...] )] [ WITH ( {storage_parameter = value} [, ... ] ) ] @@ -41,6 +41,10 @@ 该关键字为创建兼容D库的语法,指定列存选项。仅语法作用,没有实际功能。 +- **opt_clustered** + + 参数内容为CLUSTERED/NONCLUSTERED,兼容D库的语法,指定创建聚合/非聚合索引。仅语法作用,没有实际功能。 + ## 示例 ```sql @@ -49,6 +53,12 @@ CREATE TABLE openGauss=# create columnstore index on t1 (a); NOTICE: The COLUMNSTORE option is currently ignored CREATE INDEX + +openGauss=# create table t1 (a int); +CREATE TABLE +openGauss=# create clustered index on t1 (a); +NOTICE: The COLUMNSTORE option is currently ignored +CREATE INDEX ``` ## 相关链接 diff --git a/content/docs-lite/zh/docs/ExtensionReference/shark-DELETE.md b/content/docs-lite/zh/docs/ExtensionReference/shark-DELETE.md new file mode 100644 index 000000000..c858a60fa --- /dev/null +++ b/content/docs-lite/zh/docs/ExtensionReference/shark-DELETE.md @@ -0,0 +1,47 @@ +# DELETE + +## 功能描述 + +DELETE从指定的表里删除满足WHERE子句的行。如果WHERE子句不存在,将删除表中所有行,结果只保留表结构。 + +## 注意事项b + +本章节仅包含shark新增语法,原openGauss的UPDATE语法未作修改。原openGauss的UPDATE语法请参考章节[DELETE](../SQLReference/DELETE.md) + +## 语法格式 + +``` +单表删除: +[ WITH [ RECURSIVE ] with_query [, ...] ] +DELETE [/*+ plan_hint */] [FROM] [ ONLY ] table_name [ * ] [ [ [partition_clause] [ [ AS ] alias ] ] | [ [ [ AS ] alias ] [partitions_clause] ] ] + [ USING using_list ] + [ FROM from_list + [JOIN join_table ON join_condition]... ] + [ WHERE condition | WHERE CURRENT OF cursor_name ] + [ ORDER BY {expression [ [ ASC | DESC | USING operator ] + [ LIMIT { count } ] + [ RETURNING { * | { output_expr [ [ AS ] output_name ] } [, ...] } ]; + +多表删除: +[ WITH [ RECURSIVE ] with_query [, ...] ] +DELETE [/*+ plan_hint */] [FROM] + {[ ONLY ] table_name [ * ] [ [ [partition_clause] [ [ AS ] alias ] ] | [ [ [ AS ] alias ] [partitions_clause] ] ]} [, ...] + [ USING using_list ] + [ FROM from_list + [JOIN join_table ON join_condition]... ] + [ WHERE condition ]; +或 +[ WITH [ RECURSIVE ] with_query [, ...] ] +DELETE [/*+ plan_hint */] + {[ ONLY ] table_name [ * ] [ [ [partition_clause] [ [ AS ] alias ] ] | [ [ [ AS ] alias ] [partitions_clause] ] ]} [, ...] + [ FROM using_list ] + [ WHERE condition ]; +``` + +## 参数说明 + +- **JOIN** + +JOIN包含 INNER JOIN,LEFT JOIN,RIGHT JOIN,FULL JOIN,CROSS JOIN。 + + diff --git "a/content/docs-lite/zh/docs/ExtensionReference/shark-GUC\345\217\202\346\225\260\350\257\264\346\230\216.md" "b/content/docs-lite/zh/docs/ExtensionReference/shark-GUC\345\217\202\346\225\260\350\257\264\346\230\216.md" new file mode 100644 index 000000000..3dde996d9 --- /dev/null +++ "b/content/docs-lite/zh/docs/ExtensionReference/shark-GUC\345\217\202\346\225\260\350\257\264\346\230\216.md" @@ -0,0 +1,20 @@ +# GUC参数说明 + +## d\_format\_behavior\_compat\_options + +**取值范围**:字符串 + +**默认值**:'' + +**参数说明**:参数值为逗号间隔的字符串,仅允许合法字符串设定,不合法情况下,启动后报error。同样,设置时候,如果新值非法,则报error并且不修改老值。目前可选参数有: + +- enable_sbr_identifier:是否允许使用 [] 包裹标识符。开启以后内核原有的数组相关语法会被禁用。 +``` +openGauss=# set d_format_behavior_compat_options = 'enable_sbr_identifier'; +SET +openGauss=# create table[array](a1 int); +CREATE TABLE +openGauss=# select ARRAY[1,2,3]; +ERROR: syntax error at or near "[1,2,3]" +``` + diff --git a/content/docs-lite/zh/docs/ExtensionReference/shark-INSERT.md b/content/docs-lite/zh/docs/ExtensionReference/shark-INSERT.md new file mode 100644 index 000000000..2b23e6f91 --- /dev/null +++ b/content/docs-lite/zh/docs/ExtensionReference/shark-INSERT.md @@ -0,0 +1,26 @@ +# INSERT + +## 功能描述 + +向表中添加一行或多行数据。 + +## 注意事项 + +- 本章节只包含shark新增的语法,原openGauss的语法未做删除和修改。 + +## 语法格式 + +``` +[ WITH [ RECURSIVE ] with_query [, ...] ] +INSERT [/*+ plan_hint */] [INTO] table_name [partition_clause] [ AS alias ] [ ( column_name [, ...] ) ] + { DEFAULT VALUES + | VALUES {( { expression | DEFAULT } [, ...] ) }[, ...] + | query } + [ ON DUPLICATE KEY UPDATE { NOTHING | { column_name = { expression | DEFAULT } } [, ...] [ WHERE condition ] }] + [ RETURNING {* | {output_expression [ [ AS ] output_name ] }[, ...]} ]; +``` + + +## 相关链接 + +[INSERT](../SQLReference/INSERT.md) diff --git "a/content/docs-lite/zh/docs/ExtensionReference/shark-SQL\350\257\255\346\263\225.md" "b/content/docs-lite/zh/docs/ExtensionReference/shark-SQL\350\257\255\346\263\225.md" index 165c71848..2645ac3be 100644 --- "a/content/docs-lite/zh/docs/ExtensionReference/shark-SQL\350\257\255\346\263\225.md" +++ "b/content/docs-lite/zh/docs/ExtensionReference/shark-SQL\350\257\255\346\263\225.md" @@ -1,3 +1,7 @@ # SQL语法 +- **[GUC参数说明](shark-GUC参数说明.md)** - **[CREATE INDEX](shark-CREATE-INDEX.md)** +- **[INSERT](shark-INSERT.md)** +- **[UPDATE](shark-UPDATE.md)** +- **[DELETE](shark-DELETE.md)** \ No newline at end of file diff --git a/content/docs-lite/zh/docs/ExtensionReference/shark-UPDATE.md b/content/docs-lite/zh/docs/ExtensionReference/shark-UPDATE.md new file mode 100644 index 000000000..bd1f33541 --- /dev/null +++ b/content/docs-lite/zh/docs/ExtensionReference/shark-UPDATE.md @@ -0,0 +1,50 @@ +# UPDATE + +## 功能描述 + +更新表中的数据。UPDATE修改满足条件的所有行中指定的字段值,WHERE子句声明条件,SET子句指定的字段会被修改,没有出现的字段则保持它们的原值。 + +## 注意事项 + + 本章节仅包含shark新增语法,原openGauss的UPDATE语法未作修改。原openGauss的UPDATE语法请参考章节[UPDATE](../SQLReference/UPDATE.md) + +## 语法格式 + +``` +单表更新: +[ WITH [ RECURSIVE ] with_query [, ...] ] +UPDATE [/*+ plan_hint */] [ ONLY ] table_name [ partition_clause ] [ * ] [ [ AS ] alias ] +SET {column_name = { expression | DEFAULT } + |( column_name [, ...] ) = {( { expression | DEFAULT } [, ...] ) |sub_query }}[, ...] + [ FROM from_list] [JOIN join_table ON join_condition]... ] + [ WHERE condition | WHERE CURRENT OF cursor_name ] + [ ORDER BY {expression [ [ ASC | DESC | USING operator ] + [ LIMIT { count } ] + [ RETURNING {* + | {output_expression [ [ AS ] output_name ]} [, ...] }]; + +多表更新: +[ WITH [ RECURSIVE ] with_query [, ...] ] +UPDATE [/*+ plan_hint */] table_list +SET {column_name = { expression | DEFAULT } + |( column_name [, ...] ) = {( { expression | DEFAULT } [, ...] ) |sub_query }}[, ...] + [ FROM from_list] [ WHERE condition ]; + +where sub_query can be: +SELECT [ ALL | DISTINCT [ ON ( expression [, ...] ) ] ] +{ * | {expression [ [ AS ] output_name ]} [, ...] } +[ FROM from_item [, ...] ] [JOIN join_table ON join_condition]... ] +[ WHERE condition ] +[ GROUP BY grouping_element [, ...] ] +[ HAVING condition [, ...] ] +[ ORDER BY {expression [ [ ASC | DESC | USING operator ] | nlssort_expression_clause ] [ NULLS { FIRST | LAST } ]} [, ...] ] +[ LIMIT { [offset,] count | ALL } ] +``` + +## 参数说明 + +- **JOIN** + +JOIN包含 INNER JOIN,LEFT JOIN,RIGHT JOIN,FULL JOIN,CROSS JOIN。 + + \ No newline at end of file diff --git "a/content/docs-lite/zh/docs/ExtensionReference/shark-\345\205\263\351\224\256\345\255\227.md" "b/content/docs-lite/zh/docs/ExtensionReference/shark-\345\205\263\351\224\256\345\255\227.md" index 510d5c7af..5c5d0a777 100644 --- "a/content/docs-lite/zh/docs/ExtensionReference/shark-\345\205\263\351\224\256\345\255\227.md" +++ "b/content/docs-lite/zh/docs/ExtensionReference/shark-\345\205\263\351\224\256\345\255\227.md" @@ -15,7 +15,7 @@ SQL里有保留字和非保留字之分。根据标准,保留字决不能用 相比于原始的openGauss,shark对于关键字的修改主要为: -1. 新增```columnstore```,作为非保留关键字。 +1. 新增```columnstore```,```clustered```,```nonclustered```作为非保留关键字。 **表 1** SQL关键字 @@ -1020,6 +1020,24 @@ SQL里有保留字和非保留字之分。根据标准,保留字决不能用

-

+

CLUSTERED

+ +

非保留

+ +

-

+ +

-

+ + +

NONCLUSTERED

+ +

非保留

+ +

-

+ +

-

+ +

COALESCE

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

@@ -1101,15 +1119,6 @@ SQL里有保留字和非保留字之分。根据标准,保留字决不能用

-

-

COLUMNSTORE

- -

非保留

- -

-

- -

-

- -

COMPILE

非保留

@@ -6251,22 +6260,22 @@ SQL里有保留字和非保留字之分。根据标准,保留字决不能用

保留

-

SPECIFIC

+

SPECIFICATION

-

-

+

非保留

-

保留

+

-

-

-

+

-

-

SPECIFIC

+

SPECIFIC

-

非保留

+

-

-

-

+

保留

-

-

+

-

SPECIFICTYPE

diff --git "a/content/docs-lite/zh/docs/SQLReference/\345\255\227\347\254\246\351\233\206\344\270\216\345\255\227\347\254\246\345\272\217.md" "b/content/docs-lite/zh/docs/SQLReference/\345\255\227\347\254\246\351\233\206\344\270\216\345\255\227\347\254\246\345\272\217.md" index 3fae21770..06ef38a1d 100644 --- "a/content/docs-lite/zh/docs/SQLReference/\345\255\227\347\254\246\351\233\206\344\270\216\345\255\227\347\254\246\345\272\217.md" +++ "b/content/docs-lite/zh/docs/SQLReference/\345\255\227\347\254\246\351\233\206\344\270\216\345\255\227\347\254\246\345\272\217.md" @@ -1,6 +1,6 @@ # 字符集与字符序 -字符集(Character Set)是字符的编码规则,字符序(Collation)是字符的排序规则,本章主要对 openGauss B模式(即sql\_compatibility = 'B')下的字符集、字符序进行介绍,以下介绍的字符集、字符序规则和语法仅在B模式下支持。 +字符集(Character Set)是字符的编码规则,字符序(Collation)是字符的排序规则,本章主要对 openGauss B模式和 openGauss D模式(即sql\_compatibility = 'B' 和 'D')下的字符集、字符序进行介绍,以下介绍的字符集、字符序规则和语法仅在B和D模式下支持。 字符集和字符序存在以下说明: - 每一个字符集都有一个或多个字符序,其中一个字符序为默认字符序。 @@ -42,7 +42,7 @@ openGauss 目前所支持的字符集可以参考 [CREATE DATABASE](CREATE-DATAB openGauss所有支持的字符序详见[PG\_COLLATION](../DatabaseReference/PG_COLLATION.md)系统表。 -还有部分排序规则仅支持在B模式下使用,如下: +还有部分排序规则仅支持在B和D模式下使用,如下: | 字符序 | 所属字符集 | 说明 | 空白填充 | | ------------------ | ---------- | ----------------------------------------------------- | -------- | diff --git "a/content/zh/docs/DeveloperGuide/\346\225\260\346\215\256\345\272\223\345\257\271\350\261\241\345\221\275\345\220\215.md" "b/content/zh/docs/DeveloperGuide/\346\225\260\346\215\256\345\272\223\345\257\271\350\261\241\345\221\275\345\220\215.md" index ab757fd4c..63f5fe3ab 100644 --- "a/content/zh/docs/DeveloperGuide/\346\225\260\346\215\256\345\272\223\345\257\271\350\261\241\345\221\275\345\220\215.md" +++ "b/content/zh/docs/DeveloperGuide/\346\225\260\346\215\256\345\272\223\345\257\271\350\261\241\345\221\275\345\220\215.md" @@ -5,6 +5,7 @@ - 标识符非时序表长度不超过63个字节,时序表(当前特性是实验室特性,使用时请联系华为工程师提供技术支持)长度不超过53个字符。 - 标识符以字母或下划线开头,中间字符可以是字母、数字、下划线、$、#。 - 若标识符被双引号("")包含,则可以使用合法字符的任意组合,如"123gs_column"。 +- 在D兼容性下设置d_format_behavior_compat_options = 'enable_sbr_identifier',若标识符被中括号([])包含,则可以使用合法字符的任意组合,如"123gs_column"。创建用户名对象不能包含'\\'。 - 标识符不区分大小写,只有被双引号包含才区分大小写。 - 【建议】避免使用保留或者非保留关键字命名数据库对象。 diff --git a/content/zh/docs/ExtensionReference/shark-CREATE-INDEX.md b/content/zh/docs/ExtensionReference/shark-CREATE-INDEX.md index 350936e54..8c73c98c0 100644 --- a/content/zh/docs/ExtensionReference/shark-CREATE-INDEX.md +++ b/content/zh/docs/ExtensionReference/shark-CREATE-INDEX.md @@ -25,7 +25,7 @@ - 在表上创建索引。 ``` - CREATE [ UNIQUE ] [COLUMNSTORE] INDEX [ CONCURRENTLY ] [ [schema_name.]index_name ] ON table_name [ USING method ] + CREATE [ UNIQUE ] [ opt_clustered ] [COLUMNSTORE] INDEX [ CONCURRENTLY ] [ [schema_name.]index_name ] ON table_name [ USING method ] ({ { column_name [ ( length ) ] | ( expression ) } [ COLLATE collation ] [ opclass ] [ ASC | DESC ] [ NULLS { FIRST | LAST } ] }[, ...] ) [ INCLUDE ( column_name [, ...] )] [ WITH ( {storage_parameter = value} [, ... ] ) ] @@ -41,6 +41,10 @@ 该关键字为创建兼容D库的语法,指定列存选项。仅语法作用,没有实际功能。 +- **opt_clustered** + + 参数内容为CLUSTERED/NONCLUSTERED,兼容D库的语法,指定创建聚合/非聚合索引。仅语法作用,没有实际功能。 + ## 示例 ```sql @@ -49,6 +53,12 @@ CREATE TABLE openGauss=# create columnstore index on t1 (a); NOTICE: The COLUMNSTORE option is currently ignored CREATE INDEX + +openGauss=# create table t1 (a int); +CREATE TABLE +openGauss=# create clustered index on t1 (a); +NOTICE: The COLUMNSTORE option is currently ignored +CREATE INDEX ``` ## 相关链接 diff --git a/content/zh/docs/ExtensionReference/shark-DELETE.md b/content/zh/docs/ExtensionReference/shark-DELETE.md new file mode 100644 index 000000000..c858a60fa --- /dev/null +++ b/content/zh/docs/ExtensionReference/shark-DELETE.md @@ -0,0 +1,47 @@ +# DELETE + +## 功能描述 + +DELETE从指定的表里删除满足WHERE子句的行。如果WHERE子句不存在,将删除表中所有行,结果只保留表结构。 + +## 注意事项b + +本章节仅包含shark新增语法,原openGauss的UPDATE语法未作修改。原openGauss的UPDATE语法请参考章节[DELETE](../SQLReference/DELETE.md) + +## 语法格式 + +``` +单表删除: +[ WITH [ RECURSIVE ] with_query [, ...] ] +DELETE [/*+ plan_hint */] [FROM] [ ONLY ] table_name [ * ] [ [ [partition_clause] [ [ AS ] alias ] ] | [ [ [ AS ] alias ] [partitions_clause] ] ] + [ USING using_list ] + [ FROM from_list + [JOIN join_table ON join_condition]... ] + [ WHERE condition | WHERE CURRENT OF cursor_name ] + [ ORDER BY {expression [ [ ASC | DESC | USING operator ] + [ LIMIT { count } ] + [ RETURNING { * | { output_expr [ [ AS ] output_name ] } [, ...] } ]; + +多表删除: +[ WITH [ RECURSIVE ] with_query [, ...] ] +DELETE [/*+ plan_hint */] [FROM] + {[ ONLY ] table_name [ * ] [ [ [partition_clause] [ [ AS ] alias ] ] | [ [ [ AS ] alias ] [partitions_clause] ] ]} [, ...] + [ USING using_list ] + [ FROM from_list + [JOIN join_table ON join_condition]... ] + [ WHERE condition ]; +或 +[ WITH [ RECURSIVE ] with_query [, ...] ] +DELETE [/*+ plan_hint */] + {[ ONLY ] table_name [ * ] [ [ [partition_clause] [ [ AS ] alias ] ] | [ [ [ AS ] alias ] [partitions_clause] ] ]} [, ...] + [ FROM using_list ] + [ WHERE condition ]; +``` + +## 参数说明 + +- **JOIN** + +JOIN包含 INNER JOIN,LEFT JOIN,RIGHT JOIN,FULL JOIN,CROSS JOIN。 + + diff --git "a/content/zh/docs/ExtensionReference/shark-GUC\345\217\202\346\225\260\350\257\264\346\230\216.md" "b/content/zh/docs/ExtensionReference/shark-GUC\345\217\202\346\225\260\350\257\264\346\230\216.md" new file mode 100644 index 000000000..3dde996d9 --- /dev/null +++ "b/content/zh/docs/ExtensionReference/shark-GUC\345\217\202\346\225\260\350\257\264\346\230\216.md" @@ -0,0 +1,20 @@ +# GUC参数说明 + +## d\_format\_behavior\_compat\_options + +**取值范围**:字符串 + +**默认值**:'' + +**参数说明**:参数值为逗号间隔的字符串,仅允许合法字符串设定,不合法情况下,启动后报error。同样,设置时候,如果新值非法,则报error并且不修改老值。目前可选参数有: + +- enable_sbr_identifier:是否允许使用 [] 包裹标识符。开启以后内核原有的数组相关语法会被禁用。 +``` +openGauss=# set d_format_behavior_compat_options = 'enable_sbr_identifier'; +SET +openGauss=# create table[array](a1 int); +CREATE TABLE +openGauss=# select ARRAY[1,2,3]; +ERROR: syntax error at or near "[1,2,3]" +``` + diff --git a/content/zh/docs/ExtensionReference/shark-INSERT.md b/content/zh/docs/ExtensionReference/shark-INSERT.md new file mode 100644 index 000000000..2b23e6f91 --- /dev/null +++ b/content/zh/docs/ExtensionReference/shark-INSERT.md @@ -0,0 +1,26 @@ +# INSERT + +## 功能描述 + +向表中添加一行或多行数据。 + +## 注意事项 + +- 本章节只包含shark新增的语法,原openGauss的语法未做删除和修改。 + +## 语法格式 + +``` +[ WITH [ RECURSIVE ] with_query [, ...] ] +INSERT [/*+ plan_hint */] [INTO] table_name [partition_clause] [ AS alias ] [ ( column_name [, ...] ) ] + { DEFAULT VALUES + | VALUES {( { expression | DEFAULT } [, ...] ) }[, ...] + | query } + [ ON DUPLICATE KEY UPDATE { NOTHING | { column_name = { expression | DEFAULT } } [, ...] [ WHERE condition ] }] + [ RETURNING {* | {output_expression [ [ AS ] output_name ] }[, ...]} ]; +``` + + +## 相关链接 + +[INSERT](../SQLReference/INSERT.md) diff --git "a/content/zh/docs/ExtensionReference/shark-SQL\350\257\255\346\263\225.md" "b/content/zh/docs/ExtensionReference/shark-SQL\350\257\255\346\263\225.md" index 165c71848..18abb8359 100644 --- "a/content/zh/docs/ExtensionReference/shark-SQL\350\257\255\346\263\225.md" +++ "b/content/zh/docs/ExtensionReference/shark-SQL\350\257\255\346\263\225.md" @@ -1,3 +1,7 @@ # SQL语法 +- **[GUC参数说明](shark-GUC参数说明.md)** - **[CREATE INDEX](shark-CREATE-INDEX.md)** +- **[INSERT](shark-INSERT.md)** +- **[UPDATE](shark-UPDATE.md)** +- **[DELETE](shark-DELETE.md)** diff --git a/content/zh/docs/ExtensionReference/shark-UPDATE.md b/content/zh/docs/ExtensionReference/shark-UPDATE.md new file mode 100644 index 000000000..bd1f33541 --- /dev/null +++ b/content/zh/docs/ExtensionReference/shark-UPDATE.md @@ -0,0 +1,50 @@ +# UPDATE + +## 功能描述 + +更新表中的数据。UPDATE修改满足条件的所有行中指定的字段值,WHERE子句声明条件,SET子句指定的字段会被修改,没有出现的字段则保持它们的原值。 + +## 注意事项 + + 本章节仅包含shark新增语法,原openGauss的UPDATE语法未作修改。原openGauss的UPDATE语法请参考章节[UPDATE](../SQLReference/UPDATE.md) + +## 语法格式 + +``` +单表更新: +[ WITH [ RECURSIVE ] with_query [, ...] ] +UPDATE [/*+ plan_hint */] [ ONLY ] table_name [ partition_clause ] [ * ] [ [ AS ] alias ] +SET {column_name = { expression | DEFAULT } + |( column_name [, ...] ) = {( { expression | DEFAULT } [, ...] ) |sub_query }}[, ...] + [ FROM from_list] [JOIN join_table ON join_condition]... ] + [ WHERE condition | WHERE CURRENT OF cursor_name ] + [ ORDER BY {expression [ [ ASC | DESC | USING operator ] + [ LIMIT { count } ] + [ RETURNING {* + | {output_expression [ [ AS ] output_name ]} [, ...] }]; + +多表更新: +[ WITH [ RECURSIVE ] with_query [, ...] ] +UPDATE [/*+ plan_hint */] table_list +SET {column_name = { expression | DEFAULT } + |( column_name [, ...] ) = {( { expression | DEFAULT } [, ...] ) |sub_query }}[, ...] + [ FROM from_list] [ WHERE condition ]; + +where sub_query can be: +SELECT [ ALL | DISTINCT [ ON ( expression [, ...] ) ] ] +{ * | {expression [ [ AS ] output_name ]} [, ...] } +[ FROM from_item [, ...] ] [JOIN join_table ON join_condition]... ] +[ WHERE condition ] +[ GROUP BY grouping_element [, ...] ] +[ HAVING condition [, ...] ] +[ ORDER BY {expression [ [ ASC | DESC | USING operator ] | nlssort_expression_clause ] [ NULLS { FIRST | LAST } ]} [, ...] ] +[ LIMIT { [offset,] count | ALL } ] +``` + +## 参数说明 + +- **JOIN** + +JOIN包含 INNER JOIN,LEFT JOIN,RIGHT JOIN,FULL JOIN,CROSS JOIN。 + + \ No newline at end of file diff --git "a/content/zh/docs/ExtensionReference/shark-\345\205\263\351\224\256\345\255\227.md" "b/content/zh/docs/ExtensionReference/shark-\345\205\263\351\224\256\345\255\227.md" index 510d5c7af..5c5d0a777 100644 --- "a/content/zh/docs/ExtensionReference/shark-\345\205\263\351\224\256\345\255\227.md" +++ "b/content/zh/docs/ExtensionReference/shark-\345\205\263\351\224\256\345\255\227.md" @@ -15,7 +15,7 @@ SQL里有保留字和非保留字之分。根据标准,保留字决不能用 相比于原始的openGauss,shark对于关键字的修改主要为: -1. 新增```columnstore```,作为非保留关键字。 +1. 新增```columnstore```,```clustered```,```nonclustered```作为非保留关键字。 **表 1** SQL关键字 @@ -1020,6 +1020,24 @@ SQL里有保留字和非保留字之分。根据标准,保留字决不能用

-

+

CLUSTERED

+ +

非保留

+ +

-

+ +

-

+ + +

NONCLUSTERED

+ +

非保留

+ +

-

+ +

-

+ +

COALESCE

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

@@ -1101,15 +1119,6 @@ SQL里有保留字和非保留字之分。根据标准,保留字决不能用

-

-

COLUMNSTORE

- -

非保留

- -

-

- -

-

- -

COMPILE

非保留

@@ -6251,22 +6260,22 @@ SQL里有保留字和非保留字之分。根据标准,保留字决不能用

保留

-

SPECIFIC

+

SPECIFICATION

-

-

+

非保留

-

保留

+

-

-

-

+

-

-

SPECIFIC

+

SPECIFIC

-

非保留

+

-

-

-

+

保留

-

-

+

-

SPECIFICTYPE

diff --git "a/content/zh/docs/SQLReference/\345\255\227\347\254\246\351\233\206\344\270\216\345\255\227\347\254\246\345\272\217.md" "b/content/zh/docs/SQLReference/\345\255\227\347\254\246\351\233\206\344\270\216\345\255\227\347\254\246\345\272\217.md" index 06454a82f..fca553aa6 100644 --- "a/content/zh/docs/SQLReference/\345\255\227\347\254\246\351\233\206\344\270\216\345\255\227\347\254\246\345\272\217.md" +++ "b/content/zh/docs/SQLReference/\345\255\227\347\254\246\351\233\206\344\270\216\345\255\227\347\254\246\345\272\217.md" @@ -1,6 +1,6 @@ # 字符集与字符序 -字符集(Character Set)是字符的编码规则,字符序(Collation)是字符的排序规则,本章主要对 openGauss B模式(即sql\_compatibility = 'B')下的字符集、字符序进行介绍,以下介绍的字符集、字符序规则和语法仅在B模式下支持。 +字符集(Character Set)是字符的编码规则,字符序(Collation)是字符的排序规则,本章主要对 openGauss B模式和 openGauss D模式(即sql\_compatibility = 'B' 和 'D')下的字符集、字符序进行介绍,以下介绍的字符集、字符序规则和语法仅在B和D模式下支持。 字符集和字符序存在以下说明: - 每一个字符集都有一个或多个字符序,其中一个字符序为默认字符序。 @@ -42,7 +42,7 @@ openGauss 目前所支持的字符集可以参考 [CREATE DATABASE](CREATE-DATAB openGauss所有支持的字符序详见[PG\_COLLATION](../DatabaseReference/PG_COLLATION.md)系统表。 -还有部分字符序规则仅支持在B模式下使用,如下: +还有部分字符序规则仅支持在B和D模式下使用,如下: | 字符序 | 所属字符集 | 说明 | 空白填充 | | ------------------ | ---------- | ----------------------------------------------------- | -------- | @@ -60,7 +60,7 @@ openGauss所有支持的字符序详见[PG\_COLLATION](../DatabaseReference/PG_C ![](public_sys-resources/icon-note.png) **说明:** -- 以上字符序仅在B模式下可以使用。 +- 以上字符序仅在B和D模式下可以使用。 - 字符序名称以与它们相关联的字符集的名称开头,通常后跟一个或多个表示其他字符序特征的后缀,例如: _bin表示二进制排序规则, _ci表示不区分大小写。 - 当字符序支持空白填充属性,则字符串比较时忽略末尾空格,例如 : 'A ' = 'A'。 -- Gitee