diff --git a/content/en/docs/Developerguide/asynchronous-i-o-operations.md b/content/en/docs/Developerguide/asynchronous-i-o-operations.md index 7438a2f771b1e1aff7e4cc2082808efff8fd4357..0935ebd0bd05986a25aceac1e2ed5e07f3ab1d65 100644 --- a/content/en/docs/Developerguide/asynchronous-i-o-operations.md +++ b/content/en/docs/Developerguide/asynchronous-i-o-operations.md @@ -17,7 +17,7 @@ This parameter is a SUSET parameter. Set it based on instructions provided in [ **Parameter description**: Specifies whether to enable the ADIO function. -This parameter is a POSTMASTER parameter. Set it based on instructions provided in [Table 1](resetting-parameters.md#en-us_topic_0237121562_en-us_topic_0059777490_t91a6f212010f4503b24d7943aed6d846). +The current version does not support enabling the asynchronous IO function. By default, this function is disabled. Please do not modify it yourself. **Value range**: Boolean diff --git a/content/en/docs/Developerguide/boolean-data-types.md b/content/en/docs/Developerguide/boolean-data-types.md index 402a3dfd8cc0932ecaff98bde3840997b2dc152f..b979045082bfda4026eae7205aefbdcb7ec23739 100644 --- a/content/en/docs/Developerguide/boolean-data-types.md +++ b/content/en/docs/Developerguide/boolean-data-types.md @@ -27,11 +27,11 @@ Valid literal values for the "true" state include: -TRUE, 't', 'true', 'y', 'yes', and '1' +TRUE, 't', 'true', 'y', 'yes', '1', 1, 'TRUE' Valid literal values for the "false" state include: -FALSE, 'f', 'false', 'n', 'no', and '0' +FALSE, 'f', 'false', 'n', 'no', '0', 'FALSE', false, 0 **TRUE** and **FALSE** are standard expressions, compatible with SQL statements. diff --git a/content/en/docs/Developerguide/mode-matching-operators.md b/content/en/docs/Developerguide/mode-matching-operators.md index 224921443a1d5496bfb0ad9aee8fc91422773d9e..8700cea9090626d00d240028eba76791da67c16f 100644 --- a/content/en/docs/Developerguide/mode-matching-operators.md +++ b/content/en/docs/Developerguide/mode-matching-operators.md @@ -2,56 +2,58 @@ There are three separate approaches to pattern matching provided by the database: the traditional SQL LIKE operator, the more recent SIMILAR TO operator, and POSIX-style regular expressions. Besides these basic operators, functions can be used to extract or replace matching substrings and to split a string at matching locations. -- LIKE - - Description: Determines whether the string matches the mode string following **LIKE**. The LIKE expression returns true if the string matches the supplied pattern. \(As expected, the NOT LIKE expression returns false if LIKE returns true, and vice versa.\) - - Matching rules: - - 1. This operator can succeed only when its pattern matches the entire string. If you want to match a sequence in any position within the string, the pattern must begin and end with a percent sign. - 2. The underscore \(\_\) represents \(matching\) any single character. Percentage \(%\) indicates the wildcard character of any string. - 3. To match a literal underscore or percent sign without matching other characters, the respective character in **pattern** must be preceded by the escape character. The default escape character is the backslash but a different one can be selected by using the **ESCAPE** clause. - 4. To match with escape characters, enter two escape characters. For example: To write a **pattern** constant containing a backslash \(\\\), you need to enter two backslashes in SQL statements. - - >![](public_sys-resources/icon-note.gif) **NOTE:** - >When **standard\_conforming\_strings** is set to **off**, any backslashes you write in literal string constants will need to be doubled. Therefore, writing a pattern matching a single backslash is actually going to write four backslashes in the statement. You can avoid this by selecting a different escape character by using ESCAPE, so that the backslash is no longer a special character of LIKE. But the backslash is still the special character of the character text analyzer, so you still need two backslashes.\) You can also select no escape character by writing **ESCAPE ''**. This effectively disables the escape mechanism, which makes it impossible to turn off the special meaning of underscore and percent signs in the pattern. - - 5. The keyword ILIKE can be used instead of LIKE to make the match case-insensitive. - 6. Operator \~\~ is equivalent to LIKE, and operator \~\~\* corresponds to ILIKE. - - For example: - - ``` - postgres=# SELECT 'abc' LIKE 'abc' AS RESULT; - result - ----------- - t - (1 row) - ``` - - ``` - postgres=# SELECT 'abc' LIKE 'a%' AS RESULT; - result - ----------- - t - (1 row) - ``` - - ``` - postgres=# SELECT 'abc' LIKE '_b_' AS RESULT; - result - ----------- - t - (1 row) - ``` - - ``` - postgres=# SELECT 'abc' LIKE 'c' AS RESULT; - result - ----------- - f - (1 row) - ``` +- LIKE + + Description: Determines whether the string matches the mode string following **LIKE**. The LIKE expression returns true if the string matches the supplied pattern. \(As expected, the NOT LIKE expression returns false if LIKE returns true, and vice versa.\) + + Matching rules: + + 1. This operator can succeed only when its pattern matches the entire string. If you want to match a sequence in any position within the string, the pattern must begin and end with a percent sign. + 2. The underscore \(\_\) represents \(matching\) any single character. Percentage \(%\) indicates the wildcard character of any string. + 3. To match a literal underscore or percent sign without matching other characters, the respective character in **pattern** must be preceded by the escape character. The default escape character is the backslash but a different one can be selected by using the **ESCAPE** clause. + 4. To match with escape characters, enter two escape characters. For example: To write a **pattern** constant containing a backslash \(\\\), you need to enter two backslashes in SQL statements. + + >![](public_sys-resources/icon-note.gif) **NOTE:** + >When **standard\_conforming\_strings** is set to **off**, any backslashes you write in literal string constants will need to be doubled. Therefore, writing a pattern matching a single backslash is actually going to write four backslashes in the statement. You can avoid this by selecting a different escape character by using ESCAPE, so that the backslash is no longer a special character of LIKE. But the backslash is still the special character of the character text analyzer, so you still need two backslashes.\) + > + >When compatible with MYSQL database mode (sql_compatibility = C), you can also select no escape character by writing **ESCAPE ''**. This effectively disables the escape mechanism, which makes it impossible to turn off the special meaning of underscore and percent signs in the pattern. + + 5. The keyword ILIKE can be used instead of LIKE to make the match case-insensitive. + 6. Operator \~\~ is equivalent to LIKE, and operator \~\~\* corresponds to ILIKE. + + For example: + + ``` + postgres=# SELECT 'abc' LIKE 'abc' AS RESULT; + result + ----------- + t + (1 row) + ``` + + ``` + postgres=# SELECT 'abc' LIKE 'a%' AS RESULT; + result + ----------- + t + (1 row) + ``` + + ``` + postgres=# SELECT 'abc' LIKE '_b_' AS RESULT; + result + ----------- + t + (1 row) + ``` + + ``` + postgres=# SELECT 'abc' LIKE 'c' AS RESULT; + result + ----------- + f + (1 row) + ``` - SIMILAR TO @@ -249,7 +251,7 @@ There are three separate approaches to pattern matching provided by the database For example: - + ``` postgres=# SELECT 'abc' ~ 'Abc' AS RESULT; result @@ -257,7 +259,7 @@ There are three separate approaches to pattern matching provided by the database f (1 row) ``` - + ``` postgres=# SELECT 'abc' ~* 'Abc' AS RESULT; result @@ -265,7 +267,7 @@ There are three separate approaches to pattern matching provided by the database t (1 row) ``` - + ``` postgres=# SELECT 'abc' !~ 'Abc' AS RESULT; result @@ -273,7 +275,7 @@ There are three separate approaches to pattern matching provided by the database t (1 row) ``` - + ``` postgres=# SELECT 'abc'!~* 'Abc' AS RESULT; result @@ -281,7 +283,7 @@ There are three separate approaches to pattern matching provided by the database f (1 row) ``` - + ``` postgres=# SELECT 'abc' ~ '^a' AS RESULT; result @@ -289,7 +291,7 @@ There are three separate approaches to pattern matching provided by the database t (1 row) ``` - + ``` postgres=# SELECT 'abc' ~ '(b|d)'AS RESULT; result @@ -297,7 +299,7 @@ There are three separate approaches to pattern matching provided by the database t (1 row) ``` - + ``` postgres=# SELECT 'abc' ~ '^(b|c)'AS RESULT; result @@ -305,7 +307,7 @@ There are three separate approaches to pattern matching provided by the database f (1 row) ``` - + Although most regular expression searches can be executed quickly, regular expressions can still be artificially made up of memory that takes a long time and any amount of memory. It is not recommended that you accept the regular expression search mode from the non-security mode source. If you must do this, you are advised to add the statement timeout limit. The search with the SIMILAR TO mode has the same security risks as the SIMILAR TO provides many capabilities that are the same as those of the POSIX- style regular expression. The LIKE search is much simpler than the other two options. Therefore, it is more secure to accept the non-secure mode source search. diff --git a/content/en/docs/Developerguide/record.md b/content/en/docs/Developerguide/record.md index 35d79dbba2668ecdff7b24b27641e4f3b9c3a36e..9c55c0e07a0c9cc4f492acec4b838360b8c10bff 100644 --- a/content/en/docs/Developerguide/record.md +++ b/content/en/docs/Developerguide/record.md @@ -33,7 +33,7 @@ The above syntax diagram is explained as follows: ## Example ``` -The table used in the following stored procedure is defined as follows: +The table used in the following example is defined as follows: postgres=# \d emp_rec Table "public.emp_rec" Column | Type | Modifiers @@ -47,7 +47,7 @@ postgres=# \d emp_rec comm | numeric(7,2) | deptno | numeric(2,0) | --- Perform array operations in the stored procedure. +-- Perform array operations in the function. postgres=# CREATE OR REPLACE FUNCTION regress_record(p_w VARCHAR2) RETURNS VARCHAR2 AS $$ @@ -105,10 +105,10 @@ END; $$ LANGUAGE plpgsql; --- Invoke the stored procedure. +-- Invoke the function. postgres=# CALL regress_record('abc'); --- Delete the stored procedure. -postgres=# DROP PROCEDURE regress_record; +-- Delete the function. +postgres=# DROP FUNCTION regress_record; ``` diff --git a/content/en/docs/Developerguide/trigger-functions.md b/content/en/docs/Developerguide/trigger-functions.md index 8cdd585482b9b686d1321854dcf414231695077f..e4fa378e2a75e2f078e4e27bc7831b0ad92877b9 100644 --- a/content/en/docs/Developerguide/trigger-functions.md +++ b/content/en/docs/Developerguide/trigger-functions.md @@ -1,21 +1,23 @@ # Trigger Functions -- pg\_get\_triggerdef\(oid\) +- pg\_get\_triggerdef\(oid\) - Description: Obtains the definition information of a trigger. + Description: Obtains the definition information of a trigger. - Parameter: OID of the trigger to be queried + Parameter: OID of the trigger to be queried - Return type: text + Return type: text - Example: + Example: - ``` - postgres=# SELECT pg_get_triggerdef(oid) FROM pg_trigger; - pg_get_triggerdef - ---------------------------------------------------------------------------------------------------------------------- - (0 rows) - ``` + ``` + postgres=# select pg_get_triggerdef(oid) from pg_trigger; + pg_get_triggerdef + -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + CREATE TRIGGER tg1 BEFORE INSERT ON gtest26 FOR EACH STATEMENT EXECUTE PROCEDURE gtest_trigger_func() + CREATE TRIGGER tg03 AFTER INSERT ON gtest26 FOR EACH ROW WHEN ((new.a IS NOT NULL)) EXECUTE PROCEDURE gtest_trigger_func() + (2 rows) + ``` - pg\_get\_triggerdef\(oid, boolean\) @@ -28,10 +30,19 @@ Example: ``` - postgres=# SELECT pg_get_triggerdef(oid, true) FROM pg_trigger; - pg_get_triggerdef - ---------------------------------------------------------------------------------------------------------------------- - (0 rows) + postgres=# select pg_get_triggerdef(oid,true) from pg_trigger; + pg_get_triggerdef + -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + CREATE TRIGGER tg1 BEFORE INSERT ON gtest26 FOR EACH STATEMENT EXECUTE PROCEDURE gtest_trigger_func() + CREATE TRIGGER tg03 AFTER INSERT ON gtest26 FOR EACH ROW WHEN (new.a IS NOT NULL) EXECUTE PROCEDURE gtest_trigger_func() + (2 rows) + + postgres=# select pg_get_triggerdef(oid,false) from pg_trigger; + pg_get_triggerdef + -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- + CREATE TRIGGER tg1 BEFORE INSERT ON gtest26 FOR EACH STATEMENT EXECUTE PROCEDURE gtest_trigger_func() + CREATE TRIGGER tg03 AFTER INSERT ON gtest26 FOR EACH ROW WHEN ((new.a IS NOT NULL)) EXECUTE PROCEDURE gtest_trigger_func() + (2 rows) ``` diff --git a/content/en/docs/Toolreference/command-reference-1.md b/content/en/docs/Toolreference/command-reference-1.md index 55e03ef5d80bd708c4ffa921901a28a6276cacc2..51762d5548060d43a0dd890621a6e046aef5e94a 100644 --- a/content/en/docs/Toolreference/command-reference-1.md +++ b/content/en/docs/Toolreference/command-reference-1.md @@ -60,7 +60,7 @@

Specifies the name of an initialized node.

-

-

+

The node naming convention is as follows:

-E, --encoding=ENCODING

diff --git a/content/zh/docs/Developerguide/record.md b/content/zh/docs/Developerguide/record.md index d5d2934631b2536a03ae84af15d4fd1caf70ead4..00e928a659dcbe7fd4e7f0d1c72d66e9364c9d48 100644 --- a/content/zh/docs/Developerguide/record.md +++ b/content/zh/docs/Developerguide/record.md @@ -33,7 +33,7 @@ record类型的语法参见[图1](#zh-cn_topic_0237122215_fig092918316312)。 ## 示例 ``` -下面存储过程中用到的表定义如下: +下面示例中用到的表定义如下: postgres=# \d emp_rec Table "public.emp_rec" Column | Type | Modifiers @@ -47,7 +47,7 @@ postgres=# \d emp_rec comm | numeric(7,2) | deptno | numeric(2,0) | ---演示在存储过程中对数组进行操作。 +--演示在函数中对数组进行操作。 postgres=# CREATE OR REPLACE FUNCTION regress_record(p_w VARCHAR2) RETURNS VARCHAR2 AS $$ @@ -105,10 +105,10 @@ END; $$ LANGUAGE plpgsql; ---调用该存储过程。 +--调用该函数。 postgres=# CALL regress_record('abc'); ---删除存储过程。 -postgres=# DROP PROCEDURE regress_record; +--删除函数。 +postgres=# DROP FUNCTION regress_record; ``` diff --git "a/content/zh/docs/Developerguide/\346\250\241\345\274\217\345\214\271\351\205\215\346\223\215\344\275\234\347\254\246.md" "b/content/zh/docs/Developerguide/\346\250\241\345\274\217\345\214\271\351\205\215\346\223\215\344\275\234\347\254\246.md" index c734a6552e234c06aafc6f90fbd28367e88d2421..a593c71ea1d05f518add21313da21ad6d953876d 100644 --- "a/content/zh/docs/Developerguide/\346\250\241\345\274\217\345\214\271\351\205\215\346\223\215\344\275\234\347\254\246.md" +++ "b/content/zh/docs/Developerguide/\346\250\241\345\274\217\345\214\271\351\205\215\346\223\215\344\275\234\347\254\246.md" @@ -2,56 +2,58 @@ 数据库提供了三种独立的实现模式匹配的方法:SQL LIKE操作符、SIMILAR TO操作符和POSIX-风格的正则表达式。除了这些基本的操作符外,还有一些函数可用于提取或替换匹配子串并在匹配位置分离一个串。 -- LIKE - - 描述:判断字符串是否能匹配上LIKE后的模式字符串。如果字符串与提供的模式匹配,则LIKE表达式返回为真(NOT LIKE表达式返回假),否则返回为假(NOT LIKE表达式返回真)。 - - 匹配规则: - - 1. 此操作符只有在它的模式匹配整个串的时候才能成功。如果要匹配在串内任何位置的序列,该模式必须以百分号开头和结尾。 - 2. 下划线 (\_)代表(匹配)任何单个字符; 百分号(%)代表任意串的通配符。 - 3. 要匹配文本里的下划线或者百分号,在提供的模式里相应字符必须前导逃逸字符。逃逸字符的作用是禁用元字符的特殊含义,缺省的逃逸字符是反斜线,也可以用ESCAPE子句指定一个不同的逃逸字符。 - 4. 要匹配逃逸字符本身,写两个逃逸字符。例如要写一个包含反斜线的模式常量,那你就要在SQL语句里写两个反斜线。 - - >![](public_sys-resources/icon-note.gif) **说明:** - >参数standard\_conforming\_strings设置为off时,在文串常量中写的任何反斜线都需要被双写。因此,写一个匹配单个反斜线的模式实际上要在语句里写四个反斜线。(你可以通过用ESCAPE选择一个不同的逃逸字符来避免这种情况,这样反斜线就不再是LIKE的特殊字符了。但仍然是字符文本分析器的特殊字符,所以你还是需要两个反斜线。)我们也可以通过写ESCAPE ''的方式不选择逃逸字符,这样可以有效地禁用逃逸机制,但是没有办法关闭下划线和百分号在模式中的特殊含义。 - - 5. 关键字ILIKE可以用于替换LIKE,区别是LIKE大小写敏感,ILIKE大小写不敏感。 - 6. 操作符\~\~等效于LIKE,操作符\~\~\*等效于ILIKE。 - - 示例: - - ``` - postgres=# SELECT 'abc' LIKE 'abc' AS RESULT; - result - ----------- - t - (1 row) - ``` - - ``` - postgres=# SELECT 'abc' LIKE 'a%' AS RESULT; - result - ----------- - t - (1 row) - ``` - - ``` - postgres=# SELECT 'abc' LIKE '_b_' AS RESULT; - result - ----------- - t - (1 row) - ``` - - ``` - postgres=# SELECT 'abc' LIKE 'c' AS RESULT; - result - ----------- - f - (1 row) - ``` +- LIKE + + 描述:判断字符串是否能匹配上LIKE后的模式字符串。如果字符串与提供的模式匹配,则LIKE表达式返回为真(NOT LIKE表达式返回假),否则返回为假(NOT LIKE表达式返回真)。 + + 匹配规则: + + 1. 此操作符只有在它的模式匹配整个串的时候才能成功。如果要匹配在串内任何位置的序列,该模式必须以百分号开头和结尾。 + 2. 下划线 (\_)代表(匹配)任何单个字符; 百分号(%)代表任意串的通配符。 + 3. 要匹配文本里的下划线或者百分号,在提供的模式里相应字符必须前导逃逸字符。逃逸字符的作用是禁用元字符的特殊含义,缺省的逃逸字符是反斜线,也可以用ESCAPE子句指定一个不同的逃逸字符。 + 4. 要匹配逃逸字符本身,写两个逃逸字符。例如要写一个包含反斜线的模式常量,那你就要在SQL语句里写两个反斜线。 + + >![](public_sys-resources/icon-note.gif) **说明:** + >参数standard\_conforming\_strings设置为off时,在文串常量中写的任何反斜线都需要被双写。因此,写一个匹配单个反斜线的模式实际上要在语句里写四个反斜线。(你可以通过用ESCAPE选择一个不同的逃逸字符来避免这种情况,这样反斜线就不再是LIKE的特殊字符了。但仍然是字符文本分析器的特殊字符,所以你还是需要两个反斜线。) + > + >在兼容MYSQL数据库模式(即sql_compatibility = C)时,您也可以通过写ESCAPE ''的方式不选择逃逸字符,这样可以有效地禁用逃逸机制,但是没有办法关闭下划线和百分号在模式中的特殊含义。 + + 5. 关键字ILIKE可以用于替换LIKE,区别是LIKE大小写敏感,ILIKE大小写不敏感。 + 6. 操作符\~\~等效于LIKE,操作符\~\~\*等效于ILIKE。 + + 示例: + + ``` + postgres=# SELECT 'abc' LIKE 'abc' AS RESULT; + result + ----------- + t + (1 row) + ``` + + ``` + postgres=# SELECT 'abc' LIKE 'a%' AS RESULT; + result + ----------- + t + (1 row) + ``` + + ``` + postgres=# SELECT 'abc' LIKE '_b_' AS RESULT; + result + ----------- + t + (1 row) + ``` + + ``` + postgres=# SELECT 'abc' LIKE 'c' AS RESULT; + result + ----------- + f + (1 row) + ``` - SIMILAR TO @@ -249,7 +251,7 @@ 示例: - + ``` postgres=# SELECT 'abc' ~ 'Abc' AS RESULT; result @@ -257,7 +259,7 @@ f (1 row) ``` - + ``` postgres=# SELECT 'abc' ~* 'Abc' AS RESULT; result @@ -265,7 +267,7 @@ t (1 row) ``` - + ``` postgres=# SELECT 'abc' !~ 'Abc' AS RESULT; result @@ -273,7 +275,7 @@ t (1 row) ``` - + ``` postgres=# SELECT 'abc'!~* 'Abc' AS RESULT; result @@ -281,7 +283,7 @@ f (1 row) ``` - + ``` postgres=# SELECT 'abc' ~ '^a' AS RESULT; result @@ -289,7 +291,7 @@ t (1 row) ``` - + ``` postgres=# SELECT 'abc' ~ '(b|d)'AS RESULT; result @@ -297,7 +299,7 @@ t (1 row) ``` - + ``` postgres=# SELECT 'abc' ~ '^(b|c)'AS RESULT; result @@ -305,7 +307,7 @@ f (1 row) ``` - + 虽然大部分的正则表达式搜索都能很快地执行,但是正则表达式仍可能被人为地弄成需要任意长的时间和任意量的内存进行处理。不建议从非安全模式来源接受正则表达式搜索模式,如果必须这样做,建议加上语句超时限制。使用SIMILAR TO模式的搜索具有同样的安全性危险, 因为SIMILAR TO提供了很多和POSIX-风格正则表达式相同的能力。LIKE搜索比其他两种选项简单得多,因此在接受非安全模式来源搜索时要更安全些。