{"id":212467,"date":"2021-03-11T08:06:35","date_gmt":"2021-03-11T00:06:35","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=212467"},"modified":"2021-02-26T10:07:20","modified_gmt":"2021-02-26T02:07:20","slug":"postgresql-linux-mean","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/postgresql-linux-mean.html","title":{"rendered":"\u6559\u4f60\u51e0\u79cdPostgreSQL\u5224\u65ad\u5b57\u7b26\u4e32\u662f\u5426\u5305\u542b\u76ee\u6807\u5b57\u7b26\u4e32\u7684\u65b9\u6cd5"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u8fd9\u7bc7\u6587\u7ae0\u4e3b\u8981\u4ecb\u7ecd\u4e86PostgreSQL\u5224\u65ad\u5b57\u7b26\u4e32\u662f\u5426\u5305\u542b\u76ee\u6807\u5b57\u7b26\u4e32\u7684\u591a\u79cd\u65b9\u6cd5,\u672c\u6587\u7ed9\u5927\u5bb6\u4ecb\u7ecd\u7684\u975e\u5e38\u8be6\u7ec6\uff0c\u5bf9\u5927\u5bb6\u7684\u5b66\u4e60\u6216\u5de5\u4f5c\u5177\u6709\u4e00\u5b9a\u7684\u53c2\u8003\u501f\u9274\u4ef7\u503c\uff0c\u9700\u8981\u7684\u670b\u53cb\u53ef\u4ee5\u53c2\u8003\u4e0b<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

PostgreSQL\u5224\u65ad\u5b57\u7b26\u4e32\u5305\u542b\u7684\u51e0\u79cd\u65b9\u6cd5\uff1a<\/p>\n

\u65b9\u5f0f\u4e00\uff1a position(substring in string):<\/strong><\/span><\/div>\n

position(substring in string)\u51fd\u6570\uff1a\u53c2\u6570\u4e00\uff1a\u76ee\u6807\u5b57\u7b26\u4e32\uff0c\u53c2\u6570\u4e8c\u539f\u5b57\u7b26\u4e32\uff0c\u5982\u679c\u5305\u542b\u76ee\u6807\u5b57\u7b26\u4e32\uff0c\u4f1a\u8fd4\u56de\u76ee\u6807\u5b57\u7b26\u4e32\u7b2b\u4e00\u6b21\u51fa\u73b0\u7684\u4f4d\u7f6e\uff0c\u53ef\u4ee5\u6839\u636e\u8fd4\u56de\u503c\u662f\u5426\u5927\u4e8e0\u6765\u5224\u65ad\u662f\u5426\u5305\u542b\u76ee\u6807\u5b57\u7b26\u4e32<\/p>\n

\r\nselect position('aa' in 'abcd');\r\n position \r\n----------\r\n    0\r\nselect position('ab' in 'abcd');\r\n position \r\n----------\r\n    1\r\nselect position('ab' in 'abcdab');\r\n position \r\n----------\r\n    1<\/pre>\n
\u65b9\u5f0f\u4e8c\uff1a strpos(string, substring)<\/strong><\/span><\/div>\n

strpos(string, substring)\u51fd\u6570\uff1a\u53c2\u6570\u4e00\uff1a\u539f\u5b57\u7b26\u4e32\uff0c\u76ee\u6807\u5b57\u7b26\u4e32\uff0c\u58f0\u660e\u5b50\u4e32\u7684\u4f4d\u7f6e\uff0c\u4f5c\u7528\u4e0eposition\u51fd\u6570\u4e00\u81f4\u3002<\/p>\n

\r\nselect position('abcd','aa');\r\n position \r\n----------\r\n    0\r\n \r\nselect position('abcd','ab');\r\n position \r\n----------\r\n    1\r\n \r\nselect position('abcdab','ab');\r\n position \r\n----------\r\n    1<\/pre>\n
\u65b9\u5f0f\u4e09\uff1a\u4f7f\u7528\u6b63\u5219\u8868\u8fbe\u5f0f<\/strong><\/span><\/div>\n

\u5982\u679c\u5305\u542b\u76ee\u6807\u5b57\u7b26\u4e32\u8fd4\u56det\uff0c\u4e0d\u5305\u542b\u8fd4\u56def<\/p>\n

\r\nselect 'abcd' ~ 'aa' as result;\r\nresult\r\n------\r\n  f \r\n    \r\nselect 'abcd' ~ 'ab' as result;\r\nresult\r\n------\r\n  t \r\n    \r\nselect 'abcdab' ~ 'ab' as result;\r\nresult\r\n------\r\n  t<\/pre>\n
\u65b9\u5f0f\u56db\uff1a\u4f7f\u7528\u6570\u7ec4\u7684@>\u64cd\u4f5c\u7b26\uff08\u4e0d\u80fd\u51c6\u786e\u5224\u65ad\u662f\u5426\u5305\u542b\uff09<\/strong><\/span><\/div>\n
\r\nselect regexp_split_to_array('abcd','') @> array['b','e'] as result;\r\nresult\r\n------\r\n f\r\n \r\nselect regexp_split_to_array('abcd','') @> array['a','b'] as result;\r\nresult\r\n------\r\n t<\/pre>\n

\u6ce8\u610f\u4e0b\u9762\u8fd9\u4e9b\u4f8b\u5b50\uff1a<\/p>\n

\r\nselect regexp_split_to_array('abcd','') @> array['a','a'] as result;\r\nresult\r\n----------\r\n t\r\n \r\nselect regexp_split_to_array('abcd','') @> array['a','c'] as result;\r\nresult\r\n----------\r\n t\r\n \r\nselect regexp_split_to_array('abcd','') @> array['a','c','a','c'] as result;\r\nresult\r\n----------\r\n t<\/pre>\n

\u53ef\u4ee5\u770b\u51fa\uff0c\u6570\u7ec4\u7684\u5305\u542b\u64cd\u4f5c\u7b26\u5224\u65ad\u7684\u65f6\u5019\u4e0d\u7ba1\u987a\u5e8f\u3001\u91cd\u590d\uff0c\u53ea\u8981\u5305\u542b\u4e86\u5c31\u8fd4\u56detrue\uff0c\u5728\u771f\u6b63\u4f7f\u7528\u7684\u65f6\u5019\u6ce8\u610f\u3002<\/p>\n

\u5230\u6b64\u8fd9\u7bc7\u5173\u4e8ePostgreSQL\u5224\u65ad\u5b57\u7b26\u4e32\u662f\u5426\u5305\u542b\u76ee\u6807\u5b57\u7b26\u4e32\u7684\u6587\u7ae0\u5c31\u4ecb\u7ecd\u5230\u8fd9\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

PostgreSQL\u5224\u65ad\u5b57\u7b26\u4e32\u5305\u542b\u7684\u51e0\u79cd\u65b9\u6cd5\uff1a position(substring in string)\u51fd\u6570 […]<\/p>\n","protected":false},"author":1482,"featured_media":7449,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-212467","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/212467","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1482"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=212467"}],"version-history":[{"count":5,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/212467\/revisions"}],"predecessor-version":[{"id":212472,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/212467\/revisions\/212472"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/7449"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=212467"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=212467"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=212467"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}