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 d838f554065e61a16c91a6d63b5a0ef30de7aa8e..7d9e591c4b73cdd33487aa5269439ff2a16b2555 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 13414e28170c437b29529ead2efcc3cafb93232a..f7f32b94c8df417e30c0407461c9a08891571c3e 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 f3ad15f5794985aa312fad0b69aced7762831661..23d2531166db33661b644548495e51cd0cf037b6 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 f3ad15f5794985aa312fad0b69aced7762831661..23d2531166db33661b644548495e51cd0cf037b6 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/installation-guide/recommended-parameter-settings.md b/product/zh/docs-mogdb/v5.0/installation-guide/recommended-parameter-settings.md index c2d5b7554399b0720f4fd987a64bc41576cce65a..1ea89c26cec142e80691d0a8e129119e29cbe1b7 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/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 8a66b921a23f3efc8aee90bcbc250545d7be03e4..22d17421789cdec39135419add1ee7b2aa38f9ec 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-reference/transaction/transaction-auto-commit.md b/product/zh/docs-mogdb/v5.0/reference-guide/sql-reference/transaction/transaction-auto-commit.md index 0154e513426851f404ee89c22401b48fdae8957b..d6998ee8d4f0764fde4f2cb015a99540c6ec41b4 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,19 @@ 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'; - ``` + 注:在驱动为自动提交模式 (autocommit = on) 下,当驱动版本为JDBC 5.0.0.6/5.0.0.7、Psycopg2 5.0.0.4、ODBC 5.0.0.2时,如果打开此功能,会导致驱动的自动提交模式不生效。 - - 数据库级别: +- 通过 JDBC `setSavepoint` 后 `select` 不自动提交。 - ```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'" - ``` - - 如需关闭此功能,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时,如果打开此功能,会导致驱动的自动提交模式不生效。后续驱动版本会解决此冲突问题,临时解决方案是在驱动连接字符串里关闭此参数。 -- compat_oracle_txn_control 选项在 JDBC 5.0.0.8 、Psycopg2 5.0.0.5 之后不允许通过 `set behavior_compat_options` 修改 -- 通过 JDBC `setSavepoint` 后 `select` 不自动提交 +1. 此功能仅适用于A兼容模式。 +2. 对于驱动侧一条命令下发多条SQL语句,并且第一条语句不是start transcation/begin这种情况,所有SQL会一起自动提交。例如,`set xxx; update xxxx;`,set和update两条语句一起下发,update执行完成之后会自动提交,而非预期的显式提交。因此,使用时请注意使用单条语句书写,以避免需要显式提交的语句被自动提交。 +3. 对于函数/存储过程涉及游标OUT出参或者返回游标类型,执行完函数/存储过程之后自动提交,再次执行fetch操作,会报错找不到protal。 ## 各场景下自动提交事务行为 @@ -72,6 +49,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在不同场景下的行为描述 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 8e723ce00d34301bba5798a5bae35e909a587cc6..afa2db36e04e910ecee64f91d37e8024b33cb8e8 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参数。 - 不可与同一模式下已存在的synonym产生命名冲突。 ## 语法格式 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 f3ad15f5794985aa312fad0b69aced7762831661..23d2531166db33661b644548495e51cd0cf037b6 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/installation-guide/recommended-parameter-settings.md b/product/zh/docs-mogdb/v6.0/installation-guide/recommended-parameter-settings.md index c2d5b7554399b0720f4fd987a64bc41576cce65a..1ea89c26cec142e80691d0a8e129119e29cbe1b7 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"; 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 1a4a86e497109f971e48664adce80f624d104656..2c92495ffcb65687edd0cc060003762589ec09df 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 fdadd81c1035f6d065e7ad6e8e16496c7d9194bb..9551f0c103b6e55a64f9937413b8b2a5d20f99ab 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`语法替换已有的存储过程时,会一并重建依赖此存储过程的视图,存储过程中的参数数据类型变更等情况可能会导致重建视图失败,进而导致替换存储过程失败。此种情况下,建议先删除依赖的视图,再重建存储过程,再重新创建视图。 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 f3ad15f5794985aa312fad0b69aced7762831661..23d2531166db33661b644548495e51cd0cf037b6 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为新数据库设置缺省的区域。 - 显示帮助信息 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 ec0392dd3326aebbc80247f8416c04996ce98aa7..d8590f0770095f567595a49209fd80c554f7bf9b 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 |