From 2cdec74bbf9c8cd3e7e6c1e55bdfca03a468101c Mon Sep 17 00:00:00 2001 From: spaceoddity91719 Date: Mon, 22 Jul 2024 15:26:11 +0800 Subject: [PATCH 1/8] fix(mogdb):bug 6205 --- .../platform-and-client-compatibility.md | 82 ++++++++++++++++++- .../sql-syntax/CREATE-PROCEDURE.md | 6 +- .../platform-and-client-compatibility.md | 82 ++++++++++++++++++- .../sql-syntax/CREATE-PROCEDURE.md | 6 +- 4 files changed, 166 insertions(+), 10 deletions(-) diff --git a/product/zh/docs-mogdb/v5.0/reference-guide/guc-parameters/version-and-platform-compatibility/platform-and-client-compatibility.md b/product/zh/docs-mogdb/v5.0/reference-guide/guc-parameters/version-and-platform-compatibility/platform-and-client-compatibility.md index 8a66b921..22d17421 100644 --- a/product/zh/docs-mogdb/v5.0/reference-guide/guc-parameters/version-and-platform-compatibility/platform-and-client-compatibility.md +++ b/product/zh/docs-mogdb/v5.0/reference-guide/guc-parameters/version-and-platform-compatibility/platform-and-client-compatibility.md @@ -338,9 +338,9 @@ date: 2021-04-20 控制隐式游标状态兼容行为。设置此项,且兼容O,隐式游标状态(SQL%FOUND、SQL%NOTFOUND、SQL%ISOPNE、SQL%ROWCOUNT)由原先的仅在当前执行的函数有效,拓展到包括本函数调用的子函数有效。 -- proc_outparam_override +- proc_outparam_override - 控制存储过程出参的重载行为,打开该参数后,对于存储过程只有out出参部分不同的情况下,也可以正常调用。设置此选项后,包含了out参数的函数或者存储过程,必须显式调用out参数。打开参数后,不支持使用perform调用存储过程或函数。 + 控制存储过程出参的重载行为,打开该参数后,对于存储过程只有out出参部分不同的情况下,也可以正常调用。设置此选项后,包含了out参数的函数或者存储过程,必须显式调用out参数。 函数或者存储过程是否包含out参数,可以通过`\df 函数名`查看,例如: @@ -358,6 +358,84 @@ date: 2021-04-20 prokind | f ``` + > ![img](https://cdn-mogdb.enmotech.com/docs-media/icon/icon-notice.gif) 注意: + > + > 关闭proc_outparam_override选项时,perform操作不支持out参数传入常量,必须传入变量。打开proc_outparam_override选项时,perform支持out参数传入变量和常量,但是传入常量时会报错。示例如下: + > + > ```sql + > -- 关闭proc_outparam_override选项时,perform操作不支持out参数传入常量,必须传入变量。 + > MogDB=# show behavior_compat_options; + > behavior compat options + > ------------------------ + > (1 row) + > + > MogDB=# create or replace procedure memf_object_case0993_001(c int, d int, e int, f out int) is + > declare + > a int; + > b int; + > begin + > a :=c; + > b := d; + > f := 100; + > raise notice 'a=%, b=%, f=%', a, b, f; + > end; + > MogDB$# / + > CREATE PROCEDURE + > MogDB=# declare + > begin + > perform memf_object_case0993_001(2,2,3,10); + > end; + > MogDB$# / + > ERROR: syntax error at or near "10" + > LINE 3: perform memf_object_case0993_001(2,2,3,10); + > ^ + > MogDB=# declare + > MogDB-# f int; + > MogDB-# begin + > MogDB$# perform memf_object_case0993_001(2,2,3,f); + > MogDB$# raise notice 'f=%' f; + > MogDB$# end + > MogDB$# / + > NOTICE: a=2,b=2, f=100 + > NOTICE: f = + > ANONYMOUS BLOCK EXECUTE + > + > -- 打开proc_outparam_override选项时,perform支持out参数传入变量和常量,但是传入常量时会报错。 + > MogDB=# set behavior_compat_options = 'proc_outparam_override'; + > SET + > MogDB=# create or replace procedure memf_object_case0993_001(c int, d int,e int, f out int) is + > MogDB$# declare + > MogDB$# a int; + > MogDB$# b int; + > MogDB$# begin + > MogDB$# a := c; + > MogDB$# b := d; + > MogDB$# f := 100; + > MogDB$# raise notice'a=%, b=%, f=%', a, b, f; + > MogDB$# end; + > MogDB$# / + > CREATE PROCEDURE + > MogDB=# declare + > MogDB-# begin + > MogDB$# perform memf_object_case0993_001(2,2,3,10); + > MogDB$# end; + > MogDB$# / + > NOTICE: a=2, b=2, f=100 + > ERROR: query has no destination for result data + > HINT:If you want to discard the results of a SELECT, use PERFORM instead. + > CONTEXT: PL/pgSOL function inline_code_block line 3 at SQL statement + > MogDB=# declare + > MogDB-# f int; + > MogDB-# begin + > MOqDB$# perform memf_object_case0993_001(2,2,3,f); + > MogDB$# raise notice 'f=%', f; + > MogDB$# end + > MogDB$# / + > NOTICE: a=2, b=2, f=100 + > NOTICE: f=100 + > ANONYMOUS BLOCK EXECUTE + > ``` + - proc_implicit_for_loop_variable 控制存储过程中FOR_LOOP查询语句行为设置此项时,在FOR rec IN query LOOP语句中,若rec已经定义,不会复用已经定义的rec变量,而且重新建立一个新的变量。否则,会复用已经定义的rec变量,不会建立新的变量。 diff --git a/product/zh/docs-mogdb/v5.0/reference-guide/sql-syntax/CREATE-PROCEDURE.md b/product/zh/docs-mogdb/v5.0/reference-guide/sql-syntax/CREATE-PROCEDURE.md index 8e723ce0..9a551db0 100644 --- a/product/zh/docs-mogdb/v5.0/reference-guide/sql-syntax/CREATE-PROCEDURE.md +++ b/product/zh/docs-mogdb/v5.0/reference-guide/sql-syntax/CREATE-PROCEDURE.md @@ -28,11 +28,11 @@ customweight: 1 - 在存储过程内部调用其他有出参的函数,如果在赋值表达式中调用时,被调函数的出参可以省略,给出了也会被忽略。 - 存储过程支持参数注释的查看与导出、导入。 - 存储过程支持介于IS/AS与plsql_body之间的注释的查看与导出、导入。 -- 存储过程默认为SECURITY INVOKER权限,如果想将默认行为改为SECURITY DEFINER权限,需要设置guc参数behavior\_compat\_options='plsql\_security\_definer'。 +- 存储过程默认为SECURITY INVOKER权限,如果想将默认行为改为SECURITY DEFINER权限,需要设置guc参数behavior_compat_options='plsql_security_definer'。 - 被授予CREATE ANY FUNCTION权限的用户,可以在用户模式下创建/替换存储过程。 -- out/inout参数必须传入变量,不能够传入常量。 +- GUC参数behavior_compat_options关闭proc_outparam_override选项时,perform操作不支持out参数传入常量,必须传入变量。打开proc_outparam_override选项时,perform支持out参数传入变量和常量,但是传入常量时会报错。具体示例参见[proc_outparam_override](../guc-parameters/version-and-platform-compatibility/platform-and-client-compatibility.md#outparam)。 - 创建存储过程时,若返回类型为游标,需注意out参数在前,in参数在后。 -- 集中式环境下,想要调用in参数相同,out参数不同的存储过程,需要设置guc参数behavior\_compat\_options='proc\_outparam\_override',并且打开参数后,无论使用select还是call调用存储过程,都必须加上out参数。打开参数后,不支持使用perform调用存储过程或函数。 +- 集中式环境下,想要调用in参数相同,out参数不同的存储过程,需要设置guc参数behavior_compat_options='proc_outparam_override',并且打开参数后,无论使用select还是call调用存储过程,都必须加上out参数。打开参数后,不支持使用perform调用存储过程或函数。 - 不可与同一模式下已存在的synonym产生命名冲突。 ## 语法格式 diff --git a/product/zh/docs-mogdb/v6.0/reference-guide/guc-parameters/version-and-platform-compatibility/platform-and-client-compatibility.md b/product/zh/docs-mogdb/v6.0/reference-guide/guc-parameters/version-and-platform-compatibility/platform-and-client-compatibility.md index 1a4a86e4..2c92495f 100644 --- a/product/zh/docs-mogdb/v6.0/reference-guide/guc-parameters/version-and-platform-compatibility/platform-and-client-compatibility.md +++ b/product/zh/docs-mogdb/v6.0/reference-guide/guc-parameters/version-and-platform-compatibility/platform-and-client-compatibility.md @@ -334,9 +334,9 @@ date: 2021-04-20 控制隐式游标状态兼容行为。设置此项,且兼容O,隐式游标状态(SQL%FOUND、SQL%NOTFOUND、SQL%ISOPNE、SQL%ROWCOUNT)由原先的仅在当前执行的函数有效,拓展到包括本函数调用的子函数有效。 -- proc_outparam_override +- proc_outparam_override - 控制存储过程出参的重载行为,打开该参数后,对于存储过程只有out出参部分不同的情况下,也可以正常调用。设置此选项后,包含了out参数的函数或者存储过程,必须显式调用out参数。打开参数后,不支持使用perform调用存储过程或函数。 + 控制存储过程出参的重载行为,打开该参数后,对于存储过程只有out出参部分不同的情况下,也可以正常调用。设置此选项后,包含了out参数的函数或者存储过程,必须显式调用out参数。 函数或者存储过程是否包含out参数,可以通过`\df 函数名`查看,例如: @@ -354,6 +354,84 @@ date: 2021-04-20 prokind | f ``` + > ![img](https://cdn-mogdb.enmotech.com/docs-media/icon/icon-notice.gif) 注意: + > + > 关闭proc_outparam_override选项时,perform操作不支持out参数传入常量,必须传入变量。打开proc_outparam_override选项时,perform支持out参数传入变量和常量,但是传入常量时会报错。示例如下: + > + > ```sql + > -- 关闭proc_outparam_override选项时,perform操作不支持out参数传入常量,必须传入变量。 + > MogDB=# show behavior_compat_options; + > behavior compat options + > ------------------------ + > (1 row) + > + > MogDB=# create or replace procedure memf_object_case0993_001(c int, d int, e int, f out int) is + > declare + > a int; + > b int; + > begin + > a :=c; + > b := d; + > f := 100; + > raise notice 'a=%, b=%, f=%', a, b, f; + > end; + > MogDB$# / + > CREATE PROCEDURE + > MogDB=# declare + > begin + > perform memf_object_case0993_001(2,2,3,10); + > end; + > MogDB$# / + > ERROR: syntax error at or near "10" + > LINE 3: perform memf_object_case0993_001(2,2,3,10); + > ^ + > MogDB=# declare + > MogDB-# f int; + > MogDB-# begin + > MogDB$# perform memf_object_case0993_001(2,2,3,f); + > MogDB$# raise notice 'f=%' f; + > MogDB$# end + > MogDB$# / + > NOTICE: a=2,b=2, f=100 + > NOTICE: f = + > ANONYMOUS BLOCK EXECUTE + > + > -- 打开proc_outparam_override选项时,perform支持out参数传入变量和常量,但是传入常量时会报错。 + > MogDB=# set behavior_compat_options = 'proc_outparam_override'; + > SET + > MogDB=# create or replace procedure memf_object_case0993_001(c int, d int,e int, f out int) is + > MogDB$# declare + > MogDB$# a int; + > MogDB$# b int; + > MogDB$# begin + > MogDB$# a := c; + > MogDB$# b := d; + > MogDB$# f := 100; + > MogDB$# raise notice'a=%, b=%, f=%', a, b, f; + > MogDB$# end; + > MogDB$# / + > CREATE PROCEDURE + > MogDB=# declare + > MogDB-# begin + > MogDB$# perform memf_object_case0993_001(2,2,3,10); + > MogDB$# end; + > MogDB$# / + > NOTICE: a=2, b=2, f=100 + > ERROR: query has no destination for result data + > HINT:If you want to discard the results of a SELECT, use PERFORM instead. + > CONTEXT: PL/pgSOL function inline_code_block line 3 at SQL statement + > MogDB=# declare + > MogDB-# f int; + > MogDB-# begin + > MOqDB$# perform memf_object_case0993_001(2,2,3,f); + > MogDB$# raise notice 'f=%', f; + > MogDB$# end + > MogDB$# / + > NOTICE: a=2, b=2, f=100 + > NOTICE: f=100 + > ANONYMOUS BLOCK EXECUTE + > ``` + - proc_implicit_for_loop_variable 控制存储过程中FOR_LOOP查询语句行为设置此项时,在FOR rec IN query LOOP语句中,若rec已经定义,不会复用已经定义的rec变量,而且重新建立一个新的变量。否则,会复用已经定义的rec变量,不会建立新的变量。 diff --git a/product/zh/docs-mogdb/v6.0/reference-guide/sql-syntax/CREATE-PROCEDURE.md b/product/zh/docs-mogdb/v6.0/reference-guide/sql-syntax/CREATE-PROCEDURE.md index fdadd81c..9551f0c1 100644 --- a/product/zh/docs-mogdb/v6.0/reference-guide/sql-syntax/CREATE-PROCEDURE.md +++ b/product/zh/docs-mogdb/v6.0/reference-guide/sql-syntax/CREATE-PROCEDURE.md @@ -28,11 +28,11 @@ customweight: 1 - 在存储过程内部调用其他有出参的函数,如果在赋值表达式中调用时,被调函数的出参可以省略,给出了也会被忽略。 - 存储过程支持参数注释的查看与导出、导入。 - 存储过程支持介于IS/AS与plsql_body之间的注释的查看与导出、导入。 -- 存储过程默认为SECURITY INVOKER权限,如果想将默认行为改为SECURITY DEFINER权限,需要设置guc参数behavior\_compat\_options='plsql\_security\_definer'。 +- 存储过程默认为SECURITY INVOKER权限,如果想将默认行为改为SECURITY DEFINER权限,需要设置guc参数behavior_compat_options='plsql_security_definer'。 - 被授予CREATE ANY FUNCTION权限的用户,可以在用户模式下创建/替换存储过程。 -- out/inout参数必须传入变量,不能够传入常量。 +- GUC参数behavior_compat_options关闭proc_outparam_override选项时,perform操作不支持out参数传入常量,必须传入变量。打开proc_outparam_override选项时,perform支持out参数传入变量和常量,但是传入常量时会报错。具体示例参见[proc_outparam_override](../guc-parameters/version-and-platform-compatibility/platform-and-client-compatibility.md#outparam)。 - 创建存储过程时,若返回类型为游标,需注意out参数在前,in参数在后。 -- 集中式环境下,想要调用in参数相同,out参数不同的存储过程,需要设置guc参数behavior\_compat\_options='proc\_outparam\_override',并且打开参数后,无论使用select还是call调用存储过程,都必须加上out参数。打开参数后,不支持使用perform调用存储过程或函数。 +- 集中式环境下,想要调用in参数相同,out参数不同的存储过程,需要设置guc参数behavior_compat_options='proc_outparam_override',并且打开参数后,无论使用select还是call调用存储过程,都必须加上out参数。 - 不可与同一模式下已存在的synonym产生命名冲突。 - 通过`CREATE OR REPLACE`语法替换已有的存储过程时,会一并重建依赖此存储过程的视图,存储过程中的参数数据类型变更等情况可能会导致重建视图失败,进而导致替换存储过程失败。此种情况下,建议先删除依赖的视图,再重建存储过程,再重新创建视图。 -- Gitee From 707a523c64216d3d987b16a612a74f8d8b4dfb63 Mon Sep 17 00:00:00 2001 From: spaceoddity91719 Date: Mon, 22 Jul 2024 16:19:30 +0800 Subject: [PATCH 2/8] =?UTF-8?q?fix(mogdb):=E6=8E=A8=E8=8D=90=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E8=AE=BE=E7=BD=AE=E4=BC=98=E5=8C=96=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../installation-guide/recommended-parameter-settings.md | 9 ++++++++- .../installation-guide/recommended-parameter-settings.md | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/product/zh/docs-mogdb/v5.0/installation-guide/recommended-parameter-settings.md b/product/zh/docs-mogdb/v5.0/installation-guide/recommended-parameter-settings.md index c2d5b755..1ea89c26 100644 --- a/product/zh/docs-mogdb/v5.0/installation-guide/recommended-parameter-settings.md +++ b/product/zh/docs-mogdb/v5.0/installation-guide/recommended-parameter-settings.md @@ -7,7 +7,7 @@ date: 2021-06-24 # 推荐参数设置及新建测试库 -在安装完数据库之后,推荐执行以下shell脚本来进行初始化参数设置。 +在安装完数据库之后,推荐执行以下shell脚本来进行初始化参数设置。使用PTK安装MogDB时,PTK会根据服务器的配置进行数据库参数自动优化修改,详细信息参见[PTK文档](https://docs.mogdb.io/zh/ptk/v2.0/ref-recommend-guc)。 > 注意: > @@ -226,6 +226,13 @@ gs_om -t stop && gs_om -t start 在数据库init完成之后,如果需要进行测试,推荐新建数据库和新用户来进行测试。比如如果需要创建一个用于TPCC测试的数据库和用户,则执行以下命令。 ```sql +-- 切换至omm用户 +su - omm + +-- 登录数据库 +gsql -r + +-- 创建测试库和测试用户并授权 CREATE DATABASE tpcc_db; \c tpcc_db CREATE USER tpcc_usr WITH PASSWORD "tpcc@1234"; diff --git a/product/zh/docs-mogdb/v6.0/installation-guide/recommended-parameter-settings.md b/product/zh/docs-mogdb/v6.0/installation-guide/recommended-parameter-settings.md index c2d5b755..1ea89c26 100644 --- a/product/zh/docs-mogdb/v6.0/installation-guide/recommended-parameter-settings.md +++ b/product/zh/docs-mogdb/v6.0/installation-guide/recommended-parameter-settings.md @@ -7,7 +7,7 @@ date: 2021-06-24 # 推荐参数设置及新建测试库 -在安装完数据库之后,推荐执行以下shell脚本来进行初始化参数设置。 +在安装完数据库之后,推荐执行以下shell脚本来进行初始化参数设置。使用PTK安装MogDB时,PTK会根据服务器的配置进行数据库参数自动优化修改,详细信息参见[PTK文档](https://docs.mogdb.io/zh/ptk/v2.0/ref-recommend-guc)。 > 注意: > @@ -226,6 +226,13 @@ gs_om -t stop && gs_om -t start 在数据库init完成之后,如果需要进行测试,推荐新建数据库和新用户来进行测试。比如如果需要创建一个用于TPCC测试的数据库和用户,则执行以下命令。 ```sql +-- 切换至omm用户 +su - omm + +-- 登录数据库 +gsql -r + +-- 创建测试库和测试用户并授权 CREATE DATABASE tpcc_db; \c tpcc_db CREATE USER tpcc_usr WITH PASSWORD "tpcc@1234"; -- Gitee From 45852eb138d6ef97f2f720de5c7fca005dbb6fb5 Mon Sep 17 00:00:00 2001 From: spaceoddity91719 Date: Mon, 22 Jul 2024 16:59:44 +0800 Subject: [PATCH 3/8] =?UTF-8?q?fix(mogdb):=E6=8B=BC=E5=86=99=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools-used-in-the-internal-system/6-gs_install.md | 2 +- .../tools-used-in-the-internal-system/6-gs_install.md | 2 +- .../tools-used-in-the-internal-system/6-gs_install.md | 2 +- .../tools-used-in-the-internal-system/6-gs_install.md | 2 +- .../tools-used-in-the-internal-system/gs_install.md | 2 +- .../tools-used-in-the-internal-system/gs_install.md | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/product/zh/docs-mogdb/v2.0/reference-guide/tool-reference/tools-used-in-the-internal-system/6-gs_install.md b/product/zh/docs-mogdb/v2.0/reference-guide/tool-reference/tools-used-in-the-internal-system/6-gs_install.md index d838f554..7d9e591c 100644 --- a/product/zh/docs-mogdb/v2.0/reference-guide/tool-reference/tools-used-in-the-internal-system/6-gs_install.md +++ b/product/zh/docs-mogdb/v2.0/reference-guide/tool-reference/tools-used-in-the-internal-system/6-gs_install.md @@ -27,7 +27,7 @@ MogDB安装部署,要求用户指定配置文件,配置文件中会指定程 gs_install -X XMLFILE [--gsinit-parameter="PARAMETER" [...]] [--dn-guc="PARAMETER" [...]] [--alarm-component=ALARMCOMPONENT] [--time-out=SECS] [-l LOGFILE] ``` - > ![img](https://cdn-mogdb.enmotech.com/docs-media/icon/icon-note.gif) **说明**: 安装时若不指定字符集,默认字符集为SQL_ASCII,为简化和统一区域loacle默认设置为C,若想指定其他字符集和区域,请在安装时使用参数-gsinit-parameter=“-locale=LOCALE”来指定,LOCALE为新数据库设置缺省的区域。 + > ![img](https://cdn-mogdb.enmotech.com/docs-media/icon/icon-note.gif) **说明**: 安装时若不指定字符集,默认字符集为SQL_ASCII,为简化和统一区域locale默认设置为C,若想指定其他字符集和区域,请在安装时使用参数-gsinit-parameter=“-locale=LOCALE”来指定,LOCALE为新数据库设置缺省的区域。 - 显示帮助信息 diff --git a/product/zh/docs-mogdb/v2.1/reference-guide/tool-reference/tools-used-in-the-internal-system/6-gs_install.md b/product/zh/docs-mogdb/v2.1/reference-guide/tool-reference/tools-used-in-the-internal-system/6-gs_install.md index 13414e28..f7f32b94 100644 --- a/product/zh/docs-mogdb/v2.1/reference-guide/tool-reference/tools-used-in-the-internal-system/6-gs_install.md +++ b/product/zh/docs-mogdb/v2.1/reference-guide/tool-reference/tools-used-in-the-internal-system/6-gs_install.md @@ -27,7 +27,7 @@ MogDB安装部署,要求用户指定配置文件,配置文件中会指定程 gs_install -X XMLFILE [--gsinit-parameter="PARAMETER" [...]] [--dn-guc="PARAMETER" [...]] [--alarm-component=ALARMCOMPONENT] [--time-out=SECS] [-l LOGFILE] ``` - > ![img](https://cdn-mogdb.enmotech.com/docs-media/icon/icon-note.gif) **说明**: 安装时若不指定字符集,默认字符集为SQL_ASCII,为简化和统一区域loacle默认设置为C,若想指定其他字符集和区域,请在安装时使用参数-gsinit-parameter=“-locale=LOCALE”来指定,LOCALE为新数据库设置缺省的区域。 + > ![img](https://cdn-mogdb.enmotech.com/docs-media/icon/icon-note.gif) **说明**: 安装时若不指定字符集,默认字符集为SQL_ASCII,为简化和统一区域locale默认设置为C,若想指定其他字符集和区域,请在安装时使用参数-gsinit-parameter=“-locale=LOCALE”来指定,LOCALE为新数据库设置缺省的区域。 - 显示帮助信息 diff --git a/product/zh/docs-mogdb/v3.0/reference-guide/tool-reference/tools-used-in-the-internal-system/6-gs_install.md b/product/zh/docs-mogdb/v3.0/reference-guide/tool-reference/tools-used-in-the-internal-system/6-gs_install.md index f3ad15f5..23d25311 100644 --- a/product/zh/docs-mogdb/v3.0/reference-guide/tool-reference/tools-used-in-the-internal-system/6-gs_install.md +++ b/product/zh/docs-mogdb/v3.0/reference-guide/tool-reference/tools-used-in-the-internal-system/6-gs_install.md @@ -27,7 +27,7 @@ MogDB安装部署,要求用户指定配置文件,配置文件中会指定程 gs_install -X XMLFILE [--gsinit-parameter="PARAMETER" [...]] [--dn-guc="PARAMETER" [...]] [--alarm-component=ALARMCOMPONENT] [--time-out=SECS] [-l LOGFILE] ``` - > ![img](https://cdn-mogdb.enmotech.com/docs-media/icon/icon-note.gif) **说明**: 安装时若不指定字符集,默认字符集为SQL_ASCII,为简化和统一区域loacle默认设置为C,若想指定其他字符集和区域,请在安装时使用参数--gsinit-parameter=“--locale=LOCALE”来指定,LOCALE为新数据库设置缺省的区域。 + > ![img](https://cdn-mogdb.enmotech.com/docs-media/icon/icon-note.gif) **说明**: 安装时若不指定字符集,默认字符集为SQL_ASCII,为简化和统一区域locale默认设置为C,若想指定其他字符集和区域,请在安装时使用参数--gsinit-parameter=“--locale=LOCALE”来指定,LOCALE为新数据库设置缺省的区域。 - 显示帮助信息 diff --git a/product/zh/docs-mogdb/v3.1/reference-guide/tool-reference/tools-used-in-the-internal-system/6-gs_install.md b/product/zh/docs-mogdb/v3.1/reference-guide/tool-reference/tools-used-in-the-internal-system/6-gs_install.md index f3ad15f5..23d25311 100644 --- a/product/zh/docs-mogdb/v3.1/reference-guide/tool-reference/tools-used-in-the-internal-system/6-gs_install.md +++ b/product/zh/docs-mogdb/v3.1/reference-guide/tool-reference/tools-used-in-the-internal-system/6-gs_install.md @@ -27,7 +27,7 @@ MogDB安装部署,要求用户指定配置文件,配置文件中会指定程 gs_install -X XMLFILE [--gsinit-parameter="PARAMETER" [...]] [--dn-guc="PARAMETER" [...]] [--alarm-component=ALARMCOMPONENT] [--time-out=SECS] [-l LOGFILE] ``` - > ![img](https://cdn-mogdb.enmotech.com/docs-media/icon/icon-note.gif) **说明**: 安装时若不指定字符集,默认字符集为SQL_ASCII,为简化和统一区域loacle默认设置为C,若想指定其他字符集和区域,请在安装时使用参数--gsinit-parameter=“--locale=LOCALE”来指定,LOCALE为新数据库设置缺省的区域。 + > ![img](https://cdn-mogdb.enmotech.com/docs-media/icon/icon-note.gif) **说明**: 安装时若不指定字符集,默认字符集为SQL_ASCII,为简化和统一区域locale默认设置为C,若想指定其他字符集和区域,请在安装时使用参数--gsinit-parameter=“--locale=LOCALE”来指定,LOCALE为新数据库设置缺省的区域。 - 显示帮助信息 diff --git a/product/zh/docs-mogdb/v5.0/reference-guide/tool-reference/tools-used-in-the-internal-system/gs_install.md b/product/zh/docs-mogdb/v5.0/reference-guide/tool-reference/tools-used-in-the-internal-system/gs_install.md index f3ad15f5..23d25311 100644 --- a/product/zh/docs-mogdb/v5.0/reference-guide/tool-reference/tools-used-in-the-internal-system/gs_install.md +++ b/product/zh/docs-mogdb/v5.0/reference-guide/tool-reference/tools-used-in-the-internal-system/gs_install.md @@ -27,7 +27,7 @@ MogDB安装部署,要求用户指定配置文件,配置文件中会指定程 gs_install -X XMLFILE [--gsinit-parameter="PARAMETER" [...]] [--dn-guc="PARAMETER" [...]] [--alarm-component=ALARMCOMPONENT] [--time-out=SECS] [-l LOGFILE] ``` - > ![img](https://cdn-mogdb.enmotech.com/docs-media/icon/icon-note.gif) **说明**: 安装时若不指定字符集,默认字符集为SQL_ASCII,为简化和统一区域loacle默认设置为C,若想指定其他字符集和区域,请在安装时使用参数--gsinit-parameter=“--locale=LOCALE”来指定,LOCALE为新数据库设置缺省的区域。 + > ![img](https://cdn-mogdb.enmotech.com/docs-media/icon/icon-note.gif) **说明**: 安装时若不指定字符集,默认字符集为SQL_ASCII,为简化和统一区域locale默认设置为C,若想指定其他字符集和区域,请在安装时使用参数--gsinit-parameter=“--locale=LOCALE”来指定,LOCALE为新数据库设置缺省的区域。 - 显示帮助信息 diff --git a/product/zh/docs-mogdb/v6.0/reference-guide/tool-reference/tools-used-in-the-internal-system/gs_install.md b/product/zh/docs-mogdb/v6.0/reference-guide/tool-reference/tools-used-in-the-internal-system/gs_install.md index f3ad15f5..23d25311 100644 --- a/product/zh/docs-mogdb/v6.0/reference-guide/tool-reference/tools-used-in-the-internal-system/gs_install.md +++ b/product/zh/docs-mogdb/v6.0/reference-guide/tool-reference/tools-used-in-the-internal-system/gs_install.md @@ -27,7 +27,7 @@ MogDB安装部署,要求用户指定配置文件,配置文件中会指定程 gs_install -X XMLFILE [--gsinit-parameter="PARAMETER" [...]] [--dn-guc="PARAMETER" [...]] [--alarm-component=ALARMCOMPONENT] [--time-out=SECS] [-l LOGFILE] ``` - > ![img](https://cdn-mogdb.enmotech.com/docs-media/icon/icon-note.gif) **说明**: 安装时若不指定字符集,默认字符集为SQL_ASCII,为简化和统一区域loacle默认设置为C,若想指定其他字符集和区域,请在安装时使用参数--gsinit-parameter=“--locale=LOCALE”来指定,LOCALE为新数据库设置缺省的区域。 + > ![img](https://cdn-mogdb.enmotech.com/docs-media/icon/icon-note.gif) **说明**: 安装时若不指定字符集,默认字符集为SQL_ASCII,为简化和统一区域locale默认设置为C,若想指定其他字符集和区域,请在安装时使用参数--gsinit-parameter=“--locale=LOCALE”来指定,LOCALE为新数据库设置缺省的区域。 - 显示帮助信息 -- Gitee From 0de7707db594f9c8fcf6c680ada0d0b8e39bdde0 Mon Sep 17 00:00:00 2001 From: spaceoddity91719 Date: Wed, 24 Jul 2024 13:50:49 +0800 Subject: [PATCH 4/8] =?UTF-8?q?fix(mogdb):select=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E4=BA=8B=E5=8A=A1=E6=8F=90=E4=BA=A4=E8=A1=A5=E5=85=85=E4=B8=80?= =?UTF-8?q?=E6=9D=A1=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sql-reference/transaction/transaction-auto-commit.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/product/zh/docs-mogdb/v5.0/reference-guide/sql-reference/transaction/transaction-auto-commit.md b/product/zh/docs-mogdb/v5.0/reference-guide/sql-reference/transaction/transaction-auto-commit.md index 0154e513..0e984796 100644 --- a/product/zh/docs-mogdb/v5.0/reference-guide/sql-reference/transaction/transaction-auto-commit.md +++ b/product/zh/docs-mogdb/v5.0/reference-guide/sql-reference/transaction/transaction-auto-commit.md @@ -53,8 +53,12 @@ GUC参数[behavior_compat_options](../../guc-parameters/version-and-platform-com ``` - 在驱动为自动提交模式 (autocommit = on) 下,当驱动版本为JDBC 5.0.0.6/5.0.0.7、Psycopg2 5.0.0.4、ODBC 5.0.0.2时,如果打开此功能,会导致驱动的自动提交模式不生效。后续驱动版本会解决此冲突问题,临时解决方案是在驱动连接字符串里关闭此参数。 -- compat_oracle_txn_control 选项在 JDBC 5.0.0.8 、Psycopg2 5.0.0.5 之后不允许通过 `set behavior_compat_options` 修改 -- 通过 JDBC `setSavepoint` 后 `select` 不自动提交 + +> ![img](https://cdn-mogdb.enmotech.com/docs-media/icon/icon-notice.gif) **须知**: +> +> - compat_oracle_txn_control 选项在 JDBC 5.0.0.8 、Psycopg2 5.0.0.5 之后不允许通过 `set behavior_compat_options` 修改 +> - 通过 JDBC `setSavepoint` 后 `select` 不自动提交 +> - exec_simple_query函数在处理query时,如果query_string包含多个SQL语句(其中包括自提交语句和非自提交语句),则所有SQL会一起自动提交。使用时请注意使用单条语句书写,以避免需要显式提交的语句被自动提交。 ## 各场景下自动提交事务行为 -- Gitee From 96c069e2d254f2667304801fad0be644e27ead76 Mon Sep 17 00:00:00 2001 From: spaceoddity91719 Date: Wed, 24 Jul 2024 15:06:16 +0800 Subject: [PATCH 5/8] =?UTF-8?q?fix(mogdb):=E6=8B=BC=E5=86=99=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../security/2-managing-users-and-their-permissions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/product/zh/docs-mogdb/v6.0/security-guide/security/2-managing-users-and-their-permissions.md b/product/zh/docs-mogdb/v6.0/security-guide/security/2-managing-users-and-their-permissions.md index ec0392dd..d8590f07 100644 --- a/product/zh/docs-mogdb/v6.0/security-guide/security/2-managing-users-and-their-permissions.md +++ b/product/zh/docs-mogdb/v6.0/security-guide/security/2-managing-users-and-their-permissions.md @@ -64,7 +64,7 @@ MogDB支持以下的权限: SELECT、INSERT、UPDATE、DELETE、TRUNCATE、REFER | TRUNCATE | D | TABLE | | REFERENCES | x | TABLE, table column | | TRIGGER | t | TABLE | -| CREATE | C | DATABASE, SHEMA, TABLESPACE | +| CREATE | C | DATABASE, SCHEMA, TABLESPACE | | CONNECT | c | DATABASE | | TEMPORARY | T | DATABASE | | EXECUTE | X | FUNCTION, PROCEDURE, PACKAGE | -- Gitee From 9cf004f670ce45c9d7930634085b0cf4e6175277 Mon Sep 17 00:00:00 2001 From: spaceoddity91719 Date: Thu, 25 Jul 2024 15:40:39 +0800 Subject: [PATCH 6/8] =?UTF-8?q?fix(mogdb):SELECT-O=E7=89=B9=E6=80=A7?= =?UTF-8?q?=E8=A1=A5=E5=85=85=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../transaction/transaction-auto-commit.md | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/product/zh/docs-mogdb/v5.0/reference-guide/sql-reference/transaction/transaction-auto-commit.md b/product/zh/docs-mogdb/v5.0/reference-guide/sql-reference/transaction/transaction-auto-commit.md index 0e984796..25dd2c35 100644 --- a/product/zh/docs-mogdb/v5.0/reference-guide/sql-reference/transaction/transaction-auto-commit.md +++ b/product/zh/docs-mogdb/v5.0/reference-guide/sql-reference/transaction/transaction-auto-commit.md @@ -46,19 +46,23 @@ GUC参数[behavior_compat_options](../../guc-parameters/version-and-platform-com gs_guc reload -N all -c "behavior_compat_options = 'compat_oracle_txn_control'" ``` + **注意**:compat_oracle_txn_control选项在JDBC 5.0.0.8 、Psycopg2 5.0.0.5之后不允许通过 `set behavior_compat_options` 修改。 + 如需关闭此功能,behavior_compat_options下面的compat_oracle_txn_control设置为空字符即可。即: ```sql set behavior_compat_options = ''; ``` -- 在驱动为自动提交模式 (autocommit = on) 下,当驱动版本为JDBC 5.0.0.6/5.0.0.7、Psycopg2 5.0.0.4、ODBC 5.0.0.2时,如果打开此功能,会导致驱动的自动提交模式不生效。后续驱动版本会解决此冲突问题,临时解决方案是在驱动连接字符串里关闭此参数。 +- 在驱动为自动提交模式 (autocommit = on) 下,当驱动版本为JDBC 5.0.0.6/5.0.0.7、Psycopg2 5.0.0.4、ODBC 5.0.0.2时,如果打开此功能,会导致驱动的自动提交模式不生效。驱动版本为JDBC 5.0.0.8 、Psycopg2 5.0.0.5之后,即使内核配置参数behavior_compat_options = 'compat_oracle_txn_control'; select自动提交事务功能也不会开启。 + +- 通过 JDBC `setSavepoint` 后 `select` 不自动提交。 + +## 使用限制 -> ![img](https://cdn-mogdb.enmotech.com/docs-media/icon/icon-notice.gif) **须知**: -> -> - compat_oracle_txn_control 选项在 JDBC 5.0.0.8 、Psycopg2 5.0.0.5 之后不允许通过 `set behavior_compat_options` 修改 -> - 通过 JDBC `setSavepoint` 后 `select` 不自动提交 -> - exec_simple_query函数在处理query时,如果query_string包含多个SQL语句(其中包括自提交语句和非自提交语句),则所有SQL会一起自动提交。使用时请注意使用单条语句书写,以避免需要显式提交的语句被自动提交。 +1. 此功能仅适用于A兼容模式。 +2. 对于驱动侧一条命令下发多条SQL语句,并且第一条语句不是start transcation/begin这种情况,所有SQL会一起自动提交。例如,`set xxx; update xxxx;`,set和update两条语句一起下发,update执行完成之后会自动提交,而非预期的显式提交。因此,使用时请注意使用单条语句书写,以避免需要显式提交的语句被自动提交。 +3. 对于函数/存储过程涉及游标OUT出参或者返回游标类型,执行完函数/存储过程之后自动提交,再次执行fetch操作,会报错找不到protal。 ## 各场景下自动提交事务行为 @@ -76,6 +80,8 @@ GUC参数[behavior_compat_options](../../guc-parameters/version-and-platform-com 12. 对于特殊的DDL命令,比如explain、匿名块、execute,如果内部存在写行为,需要显式提交 13. 对于单条lock命令,函数/存储过程内部的lock命令,内核会显式地放到事务块执行,需要显式提交 14. 对于单条的declare cursor游标定义操作,内核会显式地放到事务块执行,需要显式提交。函数/存储过程内部的游标定义操作不会主动放到事务块执行,执行完函数自动提交。 +15. select into类语句需要先创建表,然后再插入数据,所以本质是DDL语句,会自动提交(5.0.8版本之后)。 +16. 为了不影响数据库初始化,该过程中此Oracle事务兼容功能默认关闭;启动数据库过程,该功能可以设置开启,并且不会影响正常启动。 ## 各种SQL在不同场景下的行为描述 -- Gitee From ffc7b10d8eec62bf6a81cef73ace428a0fc0d3b1 Mon Sep 17 00:00:00 2001 From: spaceoddity91719 Date: Thu, 25 Jul 2024 16:08:55 +0800 Subject: [PATCH 7/8] =?UTF-8?q?fix(mogdb):SELECT-O=E7=89=B9=E6=80=A7?= =?UTF-8?q?=E8=A1=A5=E5=85=85=E8=AF=B4=E6=98=8E2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../transaction/transaction-auto-commit.md | 37 ++----------------- 1 file changed, 3 insertions(+), 34 deletions(-) diff --git a/product/zh/docs-mogdb/v5.0/reference-guide/sql-reference/transaction/transaction-auto-commit.md b/product/zh/docs-mogdb/v5.0/reference-guide/sql-reference/transaction/transaction-auto-commit.md index 25dd2c35..d6998ee8 100644 --- a/product/zh/docs-mogdb/v5.0/reference-guide/sql-reference/transaction/transaction-auto-commit.md +++ b/product/zh/docs-mogdb/v5.0/reference-guide/sql-reference/transaction/transaction-auto-commit.md @@ -19,42 +19,11 @@ Oracle的事务状态控制与MogDB存在差异,Oracle对于只读命令不启 GUC参数[behavior_compat_options](../../guc-parameters/version-and-platform-compatibility/platform-and-client-compatibility.md#behavior_compat_options)新增配置项compat_oracle_txn_control。 -- 在驱动为非自动提交模式 (autocommit = off) 下,可通过以下方法开启此功能: +- 在驱动为非自动提交模式 (autocommit = off) 下,并且内核配置此参数:behavior_compat_options = 'compat_oracle_txn_control'; select自动提交事务功能开启,并且 compat_oracle_txn_control 选项在 JDBC 5.0.0.8 、Psycopg2 5.0.0.5 之后不允许通过 set behavior_compat_options 修改。 - - 会话级别: +- 在驱动为自动提交模式 (autocommit = on) 下,驱动版本为 JDBC 5.0.0.8 、Psycopg2 5.0.0.5 之后,即使内核配置此参数:behavior_compat_options = 'compat_oracle_txn_control'; select 自动提交事务功能也不会开启。 - ```sql - set behavior_compat_options = 'compat_oracle_txn_control'; - ``` - - - 数据库级别: - - ```sql - alter database postgres set behavior_compat_options = 'compat_oracle_txn_control'; - ``` - - - 用户级别: - - ```sql - alter user user_name set behavior_compat_options = 'compat_oracle_txn_control'; - ``` - - - 其他gs_guc设置方法: - - ```shell - gs_guc set -N all -c "behavior_compat_options = 'compat_oracle_txn_control'" - gs_guc reload -N all -c "behavior_compat_options = 'compat_oracle_txn_control'" - ``` - - **注意**:compat_oracle_txn_control选项在JDBC 5.0.0.8 、Psycopg2 5.0.0.5之后不允许通过 `set behavior_compat_options` 修改。 - - 如需关闭此功能,behavior_compat_options下面的compat_oracle_txn_control设置为空字符即可。即: - - ```sql - set behavior_compat_options = ''; - ``` - -- 在驱动为自动提交模式 (autocommit = on) 下,当驱动版本为JDBC 5.0.0.6/5.0.0.7、Psycopg2 5.0.0.4、ODBC 5.0.0.2时,如果打开此功能,会导致驱动的自动提交模式不生效。驱动版本为JDBC 5.0.0.8 、Psycopg2 5.0.0.5之后,即使内核配置参数behavior_compat_options = 'compat_oracle_txn_control'; select自动提交事务功能也不会开启。 + 注:在驱动为自动提交模式 (autocommit = on) 下,当驱动版本为JDBC 5.0.0.6/5.0.0.7、Psycopg2 5.0.0.4、ODBC 5.0.0.2时,如果打开此功能,会导致驱动的自动提交模式不生效。 - 通过 JDBC `setSavepoint` 后 `select` 不自动提交。 -- Gitee From 3b3b3d90810107bd496f98cbcd0c707d711ce8c5 Mon Sep 17 00:00:00 2001 From: spaceoddity91719 Date: Fri, 26 Jul 2024 15:53:27 +0800 Subject: [PATCH 8/8] fix(mogdb):bug 6195 --- .../v5.0/reference-guide/sql-syntax/CREATE-PROCEDURE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/product/zh/docs-mogdb/v5.0/reference-guide/sql-syntax/CREATE-PROCEDURE.md b/product/zh/docs-mogdb/v5.0/reference-guide/sql-syntax/CREATE-PROCEDURE.md index 9a551db0..afa2db36 100644 --- a/product/zh/docs-mogdb/v5.0/reference-guide/sql-syntax/CREATE-PROCEDURE.md +++ b/product/zh/docs-mogdb/v5.0/reference-guide/sql-syntax/CREATE-PROCEDURE.md @@ -32,7 +32,7 @@ customweight: 1 - 被授予CREATE ANY FUNCTION权限的用户,可以在用户模式下创建/替换存储过程。 - GUC参数behavior_compat_options关闭proc_outparam_override选项时,perform操作不支持out参数传入常量,必须传入变量。打开proc_outparam_override选项时,perform支持out参数传入变量和常量,但是传入常量时会报错。具体示例参见[proc_outparam_override](../guc-parameters/version-and-platform-compatibility/platform-and-client-compatibility.md#outparam)。 - 创建存储过程时,若返回类型为游标,需注意out参数在前,in参数在后。 -- 集中式环境下,想要调用in参数相同,out参数不同的存储过程,需要设置guc参数behavior_compat_options='proc_outparam_override',并且打开参数后,无论使用select还是call调用存储过程,都必须加上out参数。打开参数后,不支持使用perform调用存储过程或函数。 +- 集中式环境下,想要调用in参数相同,out参数不同的存储过程,需要设置guc参数behavior_compat_options='proc_outparam_override',并且打开参数后,无论使用select还是call调用存储过程,都必须加上out参数。 - 不可与同一模式下已存在的synonym产生命名冲突。 ## 语法格式 -- Gitee