FUNCTION字符串函数和操作符
lower
根据数据库的区域设置规则,将字符串转换为全部小写。
Converts the string to all lower case, according to the rules of the database's locale.
字符串函数和操作符 引入 9.0(基线) 现存至 20 devel 3 条签名 2 次签名变更
- 分组
- 字符串函数和操作符
- 签名数
- 3 条
- 引入版本
- 9.0(基线)
- 状态
- 现存
- 签名变更
- 2 次
- 本版来源
- 本站译文
版本轨迹
相对 PostgreSQL 17 无变化。
签名
PostgreSQL 18 里 lower 的 3 条签名,按上游手册顺序排列。参数名用斜体,类型用弱化色, 之后是返回类型。说明取自本站手册译文:标「沿用」的借用了另一版的译文,标「EN」的本站暂无译文、按英文原文显示。
-
lower(text) →text根据数据库的区域设置规则,将字符串转换为全部小写。lower('TOM')tom
-
lower(anyrange) →anyelement提取范围的下界(如果范围为空或没有下界,则返回NULL)。lower(numrange(1.1,2.2))1.1
-
lower(anymultirange) →anyelement提取多范围的下界(如果多范围为空或没有下界,则返回NULL)。lower('{[1.1,2.2)}'::nummultirange)1.1
演化历史
相邻两个大版本之间的差异,新的在前。版本号链到该版的签名。
-
PostgreSQL 14 ← 13 签名变更
lower ( anymultirange ) → anyelement -
PostgreSQL 13 ← 12 手册重排
这一跳手册重排了函数表的写法,签名文本整体改写,只记函数的增删,不逐条比较签名。
-
PostgreSQL 9.2 ← 9.1 签名变更
lower ( anyrange ) → range's element type
签名矩阵
每条签名在给出了签名的 18 个版本里的存在情况;方格指向该版的签名。只在正文里提到此函数、没有给出签名的版本不列进来,上面的版本轨迹里仍然有它们。签名文本在 PostgreSQL 13 前后写法不同,跨越那一跳的同一条签名会显示成两行。
存在 不存在
| 签名 | 9.0 | 9.1 | 9.2 | 9.3 | 9.4 | 9.5 | 9.6 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
lower ( string ) → text |
存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 不存在 |
lower ( anyrange ) → range's element type |
不存在 | 不存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 不存在 |
lower ( text ) → text |
不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 |
lower ( anyrange ) → anyelement |
不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 |
lower ( anymultirange ) → anyelement |
不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 不存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 | 存在 |
同组函数
| 函数 | 签名 | 主签名 | 版本变动 | 最近变更 |
|---|---|---|---|---|
ascii基线 |
1 | ascii ( text ) → integer |
— | |
| 返回参数的第一个字符的数字代码。 | 现存 | |||
bit_length基线 |
3 | bit_length ( text ) → integer |
— | |
| 返回字符串中的位数(8倍于octet_length)。 | 现存 | |||
btrim基线 |
2 | btrim ( string text [, characters text] ) → text |
— | |
| 从string的开头和结尾移除仅由characters中字符(默认为空格)组成的最长字符串。 | 现存 | |||
casefold |
1 | casefold ( text ) → text |
— | |
| 根据排序规则对输入字符串执行大小写折叠。 | 现存 | |||
char_length基线 |
1 | char_length ( text ) → integer |
— | |
| 返回字符串中的字符数。 | 现存 | |||
character_length基线 |
1 | character_length ( text ) → integer |
— | |
| 返回字符串中的字符数。 | 现存 | |||
chr基线 |
1 | chr ( integer ) → text |
— | |
| 返回给定代码的字符。 | 现存 | |||
concat |
1 | concat ( val1 "any" [, val2 "any" [, ...] ] ) → text |
— | |
| 串接所有参数的文本表示。 | 现存 | |||
concat_ws |
1 | concat_ws ( sep text, val1 "any" [, val2 "any" [, ...] ] ) → text |
— | |
| 用分隔符串接除第一个参数外的所有参数。 | 现存 | |||
format |
2 | format ( formatstr text [, formatarg "any" [, ...] ] ) → text |
9.31 次 | |
| 根据格式字符串对参数进行格式化;参见第 9.4.1 节。 | 现存 | |||
getdatabaseencoding |
1 | getdatabaseencoding ( ) → name |
— | |
| 返回当前数据库的编码名称。 | 现存 | |||
initcap基线 |
1 | initcap ( text ) → text |
— | |
| 将每个单词的第一个字母转换为大写(如果该字母是二合字母,且区域设置为ICU或builtin PG_UNICODE_FAST,则转换为标题大小写),其余字母转换为小写。 | 现存 | |||
left |
1 | left ( string text, n integer ) → text |
— | |
| 返回字符串最左侧的 n 个字符;如果 n 为负,则返回除最后 |n| 个字符之外的全部字符。 | 现存 | |||
length基线 |
6 | length ( text ) → integer |
9.11 次 | |
| 返回字符串中的字符数。 | 现存 | |||
lower基线 |
3 | lower ( text ) → text |
142 次 | |
| 根据数据库的区域设置规则,将字符串转换为全部小写。 | 现存 | |||
lpad基线 |
1 | lpad ( string text, length integer [, fill text] ) → text |
— | |
| 在string前面添加字符fill(默认为空格),将其填充到长度length。 | 现存 | |||
ltrim基线 |
2 | ltrim ( string text [, characters text] ) → text |
141 次 | |
| 从string的开头移除仅由characters中字符(默认为空格)组成的最长字符串。 | 现存 | |||
md5基线 |
2 | md5 ( text ) → text |
— | |
| 计算参数的 MD5 hash,结果以十六进制形式写入。 | 现存 | |||
normalize |
1 | normalize ( text [, form] ) → text |
— | |
| 将字符串转换为指定的 Unicode 规范化形式。 | 现存 | |||
octet_length基线 |
4 | octet_length ( text ) → integer |
— | |
| 返回字符串的字节数。 | 现存 | |||
overlay基线 |
3 | overlay ( string text PLACING newsubstring text FROM start integer [FOR count integer] ) → text |
— | |
| 用newsubstring替换string中从第start个字符开始、长度为count个字符的子字符串。 | 现存 | |||
parse_ident |
1 | parse_ident ( qualified_identifier text [, strict_mode boolean DEFAULT true] ) → text[] |
— | |
| 将qualified_identifier拆分为一个标识符数组,去除各个标识符的引号。 | 现存 | |||
pg_client_encoding基线 |
1 | pg_client_encoding ( ) → name |
— | |
| 返回当前客户端编码名称。 | 现存 | |||
position基线 |
3 | position ( substring text IN string text ) → integer |
— | |
| 返回substring在string中首次出现的位置;如果不存在则返回零。 | 现存 | |||
quote_ident基线 |
1 | quote_ident ( text ) → text |
— | |
| 为给定字符串添加适当的引号并返回,使其可用作SQL语句字符串中的标识符。 | 现存 | |||
quote_literal基线 |
2 | quote_literal ( text ) → text |
— | |
| 为给定字符串添加适当的引号并返回,使其可用作SQL语句字符串中的字符串字面量。 | 现存 | |||
quote_nullable基线 |
2 | quote_nullable ( text ) → text |
— | |
| 为给定字符串添加适当的引号并返回,使其可用作SQL语句字符串中的字符串字面量;如果参数为 null,则返回NULL。 | 现存 | |||
regexp_count |
2 | regexp_count ( string text, pattern text [, start integer [, flags text] ] ) → integer |
191 次 | |
| 返回 POSIX 正则表达式pattern在string中匹配的次数;参见第 9.7.3.1.2 节。 | 现存 | |||
regexp_instr |
2 | regexp_instr ( string text, pattern text [, start integer [, N integer [, endoption integer [, flags text [, subexpr integer] ] ] ] ] ) → integer |
191 次 | |
| 返回 POSIX 正则表达式pattern在string中第N次匹配的位置;如果没有这样的匹配,则返回零。 | 现存 | |||
regexp_like |
2 | regexp_like ( string text, pattern text [, flags text] ) → boolean |
191 次 | |
| 检查 POSIX 正则表达式pattern是否在string中出现;参见第 9.7.3.1.4 节。 | 现存 | |||
regexp_match |
2 | regexp_match ( string text, pattern text [, flags text] ) → text[] |
191 次 | |
| 返回 POSIX 正则表达式pattern与string的第一次匹配中的子字符串;参见第 9.7.3.1.5 节。 | 现存 | |||
regexp_matches基线 |
2 | regexp_matches ( string text, pattern text [, flags text] ) → setof text[] |
191 次 | |
| 返回 POSIX 正则表达式pattern与string的第一次匹配中的子字符串;如果使用g标志,则返回所有匹配中的子字符串。 | 现存 | |||
regexp_replace基线 |
4 | regexp_replace ( string text, pattern text, replacement text [, flags text] ) → text |
193 次 | |
| 替换第一个与 POSIX 正则表达式pattern匹配的子字符串,如果使用了g标志,则替换所有这样的匹配;参见第 9.7.3.1.7 节。 | 现存 | |||
regexp_split_to_array基线 |
2 | regexp_split_to_array ( string text, pattern text [, flags text] ) → text[] |
191 次 | |
| 使用POSIX正则表达式作为分隔符拆分string,生成一个结果的数组;参见第 9.7.3.1.9 节。 | 现存 | |||
regexp_split_to_table基线 |
2 | regexp_split_to_table ( string text, pattern text [, flags text] ) → setof text |
191 次 | |
| 使用POSIX正则表达式作为分隔符拆分string,生成一组结果;参见第 9.7.3.1.8 节。 | 现存 | |||
regexp_substr |
2 | regexp_substr ( string text, pattern text [, start integer [, N integer [, flags text [, subexpr integer] ] ] ] ) → text |
191 次 | |
| 返回string中 POSIX 正则表达式pattern的第N次匹配对应的子字符串;如果没有这样的匹配,则返回NULL。 | 现存 | |||
repeat基线 |
1 | repeat ( string text, number integer ) → text |
— | |
| 按number指定的次数重复string。 | 现存 | |||
replace基线 |
1 | replace ( string text, from text, to text ) → text |
— | |
| 将string中所有出现的子字符串from替换为子字符串to。 | 现存 | |||
reverse |
2 | reverse ( text ) → text |
181 次 | |
| 颠倒字符串中字符的顺序。 | 现存 | |||
right |
1 | right ( string text, n integer ) → text |
— | |
| 返回字符串中的最后n个字符;如果n为负数,则返回除前 |n| 个字符之外的全部字符。 | 现存 | |||
rpad基线 |
1 | rpad ( string text, length integer [, fill text] ) → text |
— | |
| 在string后面追加字符fill(默认为空格),将其填充到长度length。 | 现存 | |||
rtrim基线 |
2 | rtrim ( string text [, characters text] ) → text |
141 次 | |
| 从string的结尾移除仅由characters中字符(默认为空格)组成的最长字符串。 | 现存 | |||
split_part基线 |
1 | split_part ( string text, delimiter text, n integer ) → text |
— | |
| 在出现delimiter时拆分string,并返回第n个字段(从一开始计数);如果n为负数,则返回倒数第 |n| 个字段。 | 现存 | |||
starts_with |
1 | starts_with ( string text, prefix text ) → boolean |
— | |
| 如果 string 以 prefix开始就返回真。 | 现存 | |||
string_to_array基线 |
1 | string_to_array ( string text, delimiter text [, null_string text] ) → text[] |
9.11 次 | |
| 将string按delimiter分割,并将结果字段形成text数组。 | 现存 | |||
string_to_table |
1 | string_to_table ( string text, delimiter text [, null_string text] ) → setof text |
— | |
| 在出现delimiter 时拆分string,并将结果字段作为text行的集合返回。 | 现存 | |||
strpos基线 |
1 | strpos ( string text, substring text ) → integer |
— | |
| 返回substring在string中首次出现的位置;如果不存在则返回零。 | 现存 | |||
substr基线 |
2 | substr ( string text, start integer [, count integer] ) → text |
— | |
| 提取string中从第start个字符开始的子字符串;若指定了长度,则提取count个字符。 | 现存 | |||
substring基线 |
11 | substring ( string text [FROM start integer] [FOR count integer] ) → text |
193 次 | |
| 提取string的子字符串:若指定了起始位置,则从第start个字符开始;若指定了长度,则在提取count个字符后停止。 | 现存 | |||
to_ascii基线 |
3 | to_ascii ( string text ) → text |
— | |
| 将string从其他编码转换为ASCII,源编码可以用名称或编号指定。 | 现存 | |||
to_bin |
2 | to_bin ( integer ) → text |
— | |
| 将数字转换为等价的二进制补码表示。 | 现存 | |||
to_hex基线 |
2 | to_hex ( integer ) → text |
— | |
| 将数字转换为等价的二进制补码的十六进制表示。 | 现存 | |||
to_oct |
2 | to_oct ( integer ) → text |
— | |
| 将数字转换为等价的二进制补码的八进制表示。 | 现存 | |||
translate基线 |
1 | translate ( string text, from text, to text ) → text |
— | |
| 将string中与from集合中匹配的每个字符替换为to集合中相应的字符。 | 现存 | |||
trim基线 |
4 | trim ( [LEADING | TRAILING | BOTH] [characters text] FROM string text ) → text |
142 次 | |
| 从string的开始、末端或两端(默认为BOTH)移除仅包含characters(默认为空格)字符的最长字符串。 | 现存 | |||
unicode_assigned |
1 | unicode_assigned ( text ) → boolean |
— | |
| 如果字符串中的所有字符都是已分配的 Unicode 码点,则返回true;否则返回false。 | 现存 | |||
unistr |
1 | unistr ( text ) → text |
— | |
| 解析参数中转义的 Unicode 字符。 | 现存 | |||
upper基线 |
3 | upper ( text ) → text |
142 次 | |
| 根据数据库的区域设置规则,将字符串转换为全部大写。 | 现存 | |||