{"id":96834,"date":"2024-10-20T12:45:19","date_gmt":"2024-10-20T04:45:19","guid":{"rendered":"https:\/\/server.hk\/cnblog\/96834\/"},"modified":"2024-10-20T12:45:20","modified_gmt":"2024-10-20T04:45:20","slug":"postgresql-42846-%e7%84%a1%e6%b3%95%e5%bc%b7%e5%88%b6%e8%bd%89%e6%8f%9b-%e6%8a%a5%e9%94%99-%e6%95%85%e9%9a%9c%e4%bf%ae%e5%a4%8d-%e8%bf%9c%e7%a8%8b%e5%a4%84%e7%90%86","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/96834\/","title":{"rendered":"PostgreSQL 42846: \u7121\u6cd5\u5f37\u5236\u8f49\u63db \u62a5\u9519 \u6545\u969c\u4fee\u590d \u8fdc\u7a0b\u5904\u7406"},"content":{"rendered":"<h1 id=\"postgresql-42846-%e7%84%a1%e6%b3%95%e5%bc%b7%e5%88%b6%e8%bd%89%e6%8f%9b-%e5%a0%b1%e9%8c%af-%e6%95%85%e9%9a%9c%e4%bf%ae%e5%be%a9-%e8%bf%9c%e7%a8%8b%e5%a4%84%e7%90%86-CjZvEYolpI\">PostgreSQL 42846: \u7121\u6cd5\u5f37\u5236\u8f49\u63db \u5831\u932f \u6545\u969c\u4fee\u5fa9 \u8fdc\u7a0b\u5904\u7406<\/h1>\n<p>\u5728\u4f7f\u7528 PostgreSQL \u6578\u64da\u5eab\u6642\uff0c\u958b\u767c\u8005\u53ef\u80fd\u6703\u9047\u5230\u5404\u7a2e\u932f\u8aa4\uff0c\u5176\u4e2d\u4e4b\u4e00\u5c31\u662f\u932f\u8aa4\u4ee3\u78bc 42846\u3002\u9019\u500b\u932f\u8aa4\u901a\u5e38\u8868\u793a\u7121\u6cd5\u5f37\u5236\u8f49\u63db\u6578\u64da\u985e\u578b\uff0c\u9019\u53ef\u80fd\u6703\u5c0e\u81f4\u67e5\u8a62\u5931\u6557\u6216\u6578\u64da\u8655\u7406\u4e0d\u6b63\u78ba\u3002\u672c\u6587\u5c07\u6df1\u5165\u63a2\u8a0e\u9019\u500b\u932f\u8aa4\u7684\u539f\u56e0\u3001\u89e3\u6c7a\u65b9\u6848\u4ee5\u53ca\u5982\u4f55\u9032\u884c\u9060\u7a0b\u8655\u7406\u3002<\/p>\n<h2 id=\"%e9%8c%af%e8%aa%a4%e4%bb%a3%e7%a2%bc-42846-%e7%9a%84%e5%8e%9f%e5%9b%a0-CjZvEYolpI\">\u932f\u8aa4\u4ee3\u78bc 42846 \u7684\u539f\u56e0<\/h2>\n<p>PostgreSQL \u7684\u932f\u8aa4\u4ee3\u78bc 42846 \u901a\u5e38\u51fa\u73fe\u5728\u4ee5\u4e0b\u60c5\u6cc1\uff1a<\/p>\n<ul>\n<li><strong>\u6578\u64da\u985e\u578b\u4e0d\u5339\u914d\uff1a<\/strong>\u7576\u4f60\u5617\u8a66\u5c07\u4e00\u500b\u6578\u64da\u985e\u578b\u8f49\u63db\u70ba\u53e6\u4e00\u500b\u4e0d\u517c\u5bb9\u7684\u6578\u64da\u985e\u578b\u6642\uff0c\u6703\u51fa\u73fe\u6b64\u932f\u8aa4\u3002\u4f8b\u5982\uff0c\u5c07\u4e00\u500b\u5b57\u7b26\u4e32\u985e\u578b\u7684\u6578\u64da\u5f37\u5236\u8f49\u63db\u70ba\u6574\u6578\u985e\u578b\u3002<\/li>\n<li><strong>\u51fd\u6578\u6216\u64cd\u4f5c\u7b26\u4e0d\u652f\u6301\uff1a<\/strong>\u67d0\u4e9b\u51fd\u6578\u6216\u64cd\u4f5c\u7b26\u53ef\u80fd\u4e0d\u652f\u6301\u7279\u5b9a\u7684\u6578\u64da\u985e\u578b\uff0c\u9019\u6703\u5c0e\u81f4\u8f49\u63db\u5931\u6557\u3002<\/li>\n<li><strong>\u7f3a\u5c11\u660e\u78ba\u7684\u8f49\u63db\u8def\u5f91\uff1a<\/strong>\u5982\u679c PostgreSQL \u7121\u6cd5\u627e\u5230\u5f9e\u4e00\u500b\u6578\u64da\u985e\u578b\u5230\u53e6\u4e00\u500b\u6578\u64da\u985e\u578b\u7684\u660e\u78ba\u8f49\u63db\u8def\u5f91\uff0c\u5247\u6703\u5831\u544a\u6b64\u932f\u8aa4\u3002<\/li>\n<\/ul>\n<h2 id=\"%e5%a6%82%e4%bd%95%e4%bf%ae%e5%be%a9-postgresql-42846-%e9%8c%af%e8%aa%a4-CjZvEYolpI\">\u5982\u4f55\u4fee\u5fa9 PostgreSQL 42846 \u932f\u8aa4<\/h2>\n<p>\u4fee\u5fa9\u6b64\u932f\u8aa4\u7684\u7b2c\u4e00\u6b65\u662f\u78ba\u5b9a\u5f15\u767c\u932f\u8aa4\u7684\u5177\u9ad4\u67e5\u8a62\u6216\u64cd\u4f5c\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u898b\u7684\u89e3\u6c7a\u65b9\u6848\uff1a<\/p>\n<h3 id=\"1-%e6%aa%a2%e6%9f%a5%e6%95%b8%e6%93%9a%e9%a1%9e%e5%9e%8b-CjZvEYolpI\">1. \u6aa2\u67e5\u6578\u64da\u985e\u578b<\/h3>\n<p>\u9996\u5148\uff0c\u6aa2\u67e5\u6d89\u53ca\u7684\u6578\u64da\u985e\u578b\u3002\u4f7f\u7528 <code>SELECT<\/code> \u8a9e\u53e5\u4f86\u67e5\u770b\u8868\u4e2d\u6578\u64da\u7684\u985e\u578b\u3002\u4f8b\u5982\uff1a<\/p>\n<pre><code>SELECT column_name, data_type FROM information_schema.columns WHERE table_name = 'your_table';<\/code><\/pre>\n<p>\u78ba\u4fdd\u4f60\u5728\u67e5\u8a62\u4e2d\u4f7f\u7528\u7684\u6578\u64da\u985e\u578b\u662f\u6b63\u78ba\u7684\uff0c\u4e26\u4e14\u8207\u4f60\u60f3\u8981\u8f49\u63db\u7684\u985e\u578b\u517c\u5bb9\u3002<\/p>\n<h3 id=\"2-%e4%bd%bf%e7%94%a8%e9%a1%af%e5%bc%8f%e8%bd%89%e6%8f%9b-CjZvEYolpI\">2. \u4f7f\u7528\u986f\u5f0f\u8f49\u63db<\/h3>\n<p>\u5982\u679c\u9700\u8981\u9032\u884c\u6578\u64da\u985e\u578b\u8f49\u63db\uff0c\u5efa\u8b70\u4f7f\u7528\u986f\u5f0f\u8f49\u63db\u3002\u4f8b\u5982\uff0c\u4f7f\u7528 <code>CAST<\/code> \u6216 <code>::<\/code> \u4f86\u9032\u884c\u8f49\u63db\uff1a<\/p>\n<pre><code>SELECT CAST(your_column AS INTEGER) FROM your_table;<\/code><\/pre>\n<p>\u6216\u8005\uff1a<\/p>\n<pre><code>SELECT your_column::INTEGER FROM your_table;<\/code><\/pre>\n<h3 id=\"3-%e6%aa%a2%e6%9f%a5%e5%87%bd%e6%95%b8%e5%92%8c%e6%93%8d%e4%bd%9c%e7%ac%a6-CjZvEYolpI\">3. \u6aa2\u67e5\u51fd\u6578\u548c\u64cd\u4f5c\u7b26<\/h3>\n<p>\u78ba\u4fdd\u4f60\u4f7f\u7528\u7684\u51fd\u6578\u6216\u64cd\u4f5c\u7b26\u652f\u6301\u4f60\u6240\u4f7f\u7528\u7684\u6578\u64da\u985e\u578b\u3002\u5982\u679c\u4e0d\u652f\u6301\uff0c\u8003\u616e\u4f7f\u7528\u5176\u4ed6\u51fd\u6578\u6216\u64cd\u4f5c\u7b26\u4f86\u9054\u5230\u76f8\u540c\u7684\u76ee\u7684\u3002<\/p>\n<h3 id=\"4-%e6%9b%b4%e6%96%b0-postgresql-%e7%89%88%e6%9c%ac-CjZvEYolpI\">4. \u66f4\u65b0 PostgreSQL \u7248\u672c<\/h3>\n<p>\u6709\u6642\u5019\uff0c\u932f\u8aa4\u53ef\u80fd\u662f\u7531\u65bc PostgreSQL \u7684\u67d0\u4e9b\u7248\u672c\u4e2d\u7684 bug \u5f15\u8d77\u7684\u3002\u6aa2\u67e5\u662f\u5426\u6709\u53ef\u7528\u7684\u66f4\u65b0\uff0c\u4e26\u8003\u616e\u5347\u7d1a\u5230\u6700\u65b0\u7248\u672c\u3002<\/p>\n<h2 id=\"%e9%81%a0%e7%a8%8b%e8%99%95%e7%90%86-postgresql-%e9%8c%af%e8%aa%a4-CjZvEYolpI\">\u9060\u7a0b\u8655\u7406 PostgreSQL \u932f\u8aa4<\/h2>\n<p>\u5728\u67d0\u4e9b\u60c5\u6cc1\u4e0b\uff0c\u7279\u5225\u662f\u7576\u4f60\u7121\u6cd5\u76f4\u63a5\u8a2a\u554f\u6578\u64da\u5eab\u6642\uff0c\u9060\u7a0b\u8655\u7406\u53ef\u80fd\u662f\u5fc5\u8981\u7684\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5efa\u8b70\uff1a<\/p>\n<ul>\n<li><strong>\u4f7f\u7528 SSH \u9023\u63a5\uff1a<\/strong>\u5982\u679c\u4f60\u7684\u6578\u64da\u5eab\u904b\u884c\u5728\u9060\u7a0b\u4f3a\u670d\u5668\u4e0a\uff0c\u4f7f\u7528 SSH \u9023\u63a5\u5230\u4f3a\u670d\u5668\uff0c\u7136\u5f8c\u57f7\u884c\u5fc5\u8981\u7684\u67e5\u8a62\u548c\u4fee\u5fa9\u64cd\u4f5c\u3002<\/li>\n<li><strong>\u4f7f\u7528\u9060\u7a0b\u7ba1\u7406\u5de5\u5177\uff1a<\/strong>\u8003\u616e\u4f7f\u7528 pgAdmin \u6216\u5176\u4ed6\u6578\u64da\u5eab\u7ba1\u7406\u5de5\u5177\uff0c\u9019\u4e9b\u5de5\u5177\u901a\u5e38\u63d0\u4f9b\u9060\u7a0b\u8a2a\u554f\u529f\u80fd\uff0c\u65b9\u4fbf\u4f60\u9032\u884c\u6545\u969c\u6392\u9664\u3002<\/li>\n<li><strong>\u67e5\u770b\u65e5\u8a8c\u6587\u4ef6\uff1a<\/strong>\u6aa2\u67e5 PostgreSQL \u7684\u65e5\u8a8c\u6587\u4ef6\uff0c\u9019\u4e9b\u6587\u4ef6\u901a\u5e38\u6703\u63d0\u4f9b\u6709\u95dc\u932f\u8aa4\u7684\u66f4\u591a\u8a73\u7d30\u4fe1\u606f\uff0c\u5e6b\u52a9\u4f60\u9032\u884c\u6545\u969c\u6392\u9664\u3002<\/li>\n<\/ul>\n<h2 id=\"%e7%b8%bd%e7%b5%90-CjZvEYolpI\">\u7e3d\u7d50<\/h2>\n<p>PostgreSQL \u932f\u8aa4\u4ee3\u78bc 42846 \u901a\u5e38\u8207\u6578\u64da\u985e\u578b\u8f49\u63db\u6709\u95dc\uff0c\u4e86\u89e3\u5176\u539f\u56e0\u548c\u89e3\u6c7a\u65b9\u6848\u5c0d\u65bc\u958b\u767c\u8005\u4f86\u8aaa\u81f3\u95dc\u91cd\u8981\u3002\u901a\u904e\u6aa2\u67e5\u6578\u64da\u985e\u578b\u3001\u4f7f\u7528\u986f\u5f0f\u8f49\u63db\u3001\u6aa2\u67e5\u51fd\u6578\u548c\u64cd\u4f5c\u7b26\u4ee5\u53ca\u8003\u616e\u5347\u7d1a PostgreSQL \u7248\u672c\uff0c\u53ef\u4ee5\u6709\u6548\u5730\u89e3\u6c7a\u6b64\u554f\u984c\u3002\u6b64\u5916\uff0c\u9060\u7a0b\u8655\u7406\u65b9\u6cd5\u4e5f\u80fd\u5e6b\u52a9\u958b\u767c\u8005\u5728\u7121\u6cd5\u76f4\u63a5\u8a2a\u554f\u6578\u64da\u5eab\u6642\u9032\u884c\u6545\u969c\u6392\u9664\u3002<\/p>\n<p>\u5982\u679c\u4f60\u6b63\u5728\u5c0b\u627e\u7a69\u5b9a\u7684 <a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a> \u89e3\u6c7a\u65b9\u6848\uff0cServer.HK \u63d0\u4f9b\u591a\u7a2e\u9078\u64c7\uff0c\u6eff\u8db3\u4e0d\u540c\u9700\u6c42\u7684\u7528\u6236\u3002\u7121\u8ad6\u662f\u6578\u64da\u5eab\u7ba1\u7406\u9084\u662f\u61c9\u7528\u90e8\u7f72\uff0c\u6211\u5011\u7684 <a href=\"https:\/\/server.hk\">\u4f3a\u670d\u5668<\/a> \u90fd\u80fd\u70ba\u4f60\u63d0\u4f9b\u53ef\u9760\u7684\u652f\u6301\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u89e3\u6c7a PostgreSQL 42846 \u932f\u8aa4\uff1a\u7121\u6cd5\u5f37\u5236\u8f49\u63db\u7684\u6545\u969c\u4fee\u5fa9\u8207\u9060\u7a0b\u8655\u7406\u6307\u5357\uff0c\u52a9\u60a8\u5feb\u901f\u6062\u5fa9\u6578\u64da\u5eab\u6b63\u5e38\u904b\u884c\u3002<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-96834","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/96834","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=96834"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/96834\/revisions"}],"predecessor-version":[{"id":96835,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/96834\/revisions\/96835"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=96834"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=96834"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=96834"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}