postgresql – 运算符?<?在Postgres中
发布时间:2020-12-13 16:00:42 所属栏目:百科 来源:网络整理
导读:(最初是 this question的一部分,但它有点无关紧要,所以我决定把它作为自己的问题.) 我找不到运算符??是什么. Postgres手册仅提及?和类似的运算符here,但没有??的迹象. 在psql控制台中摆弄时,我发现这些命令会产生相同的结果: SELECT * FROM test ORDER BY n
(最初是
this question的一部分,但它有点无关紧要,所以我决定把它作为自己的问题.)
我找不到运算符?<?是什么. Postgres手册仅提及?和类似的运算符here,但没有?<?的迹象. 在psql控制台中摆弄时,我发现这些命令会产生相同的结果: SELECT * FROM test ORDER BY name USING ~<~; SELECT * FROM test ORDER BY name COLLATE "C"; 这些给出了相反的顺序: SELECT * FROM test ORDER BY name USING ~>~; SELECT * FROM test ORDER BY name COLLATE "C" DESC; 还有关于代字号运算符的一些信息: do ~*~ List of operators Schema | Name | Left arg type | Right arg type | Result type | Description ------------+------+---------------+----------------+-------------+------------------------- pg_catalog | ~<=~ | character | character | boolean | less than or equal pg_catalog | ~<=~ | text | text | boolean | less than or equal pg_catalog | ~<~ | character | character | boolean | less than pg_catalog | ~<~ | text | text | boolean | less than pg_catalog | ~>=~ | character | character | boolean | greater than or equal pg_catalog | ~>=~ | text | text | boolean | greater than or equal pg_catalog | ~>~ | character | character | boolean | greater than pg_catalog | ~>~ | text | text | boolean | greater than pg_catalog | ~~ | bytea | bytea | boolean | matches LIKE expression pg_catalog | ~~ | character | text | boolean | matches LIKE expression pg_catalog | ~~ | name | text | boolean | matches LIKE expression pg_catalog | ~~ | text | text | boolean | matches LIKE expression (12 rows) 第3行和第4行是我正在寻找的运算符,但描述对我来说有点不足. 解决方法
?> =?,?< =?,?>?和?<?是文本模式(或varchar,基本相同)运算符,它们各自的兄弟姐妹的对应物> =,< =,>和<.他们严格按字节值对字符数据进行排序,忽略任何整理设置的规则(与其兄弟姐妹相对).这使它们更快,但对大多数语言/国家也无效. “C”语言环境实际上与没有语言环境相同,这意味着没有排序规则.这解释了为什么ORDER BY name USING~<?和ORDER BY name COLLATE“C”最终做同样的事情. 关于dba.SE的相关答案的最后一章的详细说明:
> Pattern matching with LIKE,SIMILAR TO or regular expressions in PostgreSQL 注意~~是用于实现SQL > ~~ Operator In Postgres (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |