{"id":178746,"date":"2024-11-08T20:33:19","date_gmt":"2024-11-08T12:33:19","guid":{"rendered":"https:\/\/server.hk\/cnblog\/178746\/"},"modified":"2024-11-08T20:33:20","modified_gmt":"2024-11-08T12:33:20","slug":"%e5%a6%82%e4%bd%95%e4%bf%ae%e5%be%a9postgresql%e9%8c%af%e8%aa%a4%e4%bb%a3%e7%a2%bc%ef%bc%9a22022-indicator_overflow%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/178746\/","title":{"rendered":"\u5982\u4f55\u4fee\u5fa9PostgreSQL\u932f\u8aa4\u4ee3\u78bc\uff1a22022 &#8211; indicator_overflow\uff1f"},"content":{"rendered":"<h1 id=\"%e5%a6%82%e4%bd%95%e4%bf%ae%e5%be%a9postgresql%e9%8c%af%e8%aa%a4%e4%bb%a3%e7%a2%bc%ef%bc%9a22022-indicator_overflow-GfpSSXTNca\">\u5982\u4f55\u4fee\u5fa9PostgreSQL\u932f\u8aa4\u4ee3\u78bc\uff1a22022 &#8211; indicator_overflow<\/h1>\n<p>\u5728\u4f7f\u7528PostgreSQL\u6578\u64da\u5eab\u6642\uff0c\u958b\u767c\u8005\u548c\u6578\u64da\u5eab\u7ba1\u7406\u54e1\u53ef\u80fd\u6703\u9047\u5230\u5404\u7a2e\u932f\u8aa4\u4ee3\u78bc\uff0c\u5176\u4e2d\u4e4b\u4e00\u662f22022 &#8211; indicator_overflow\u3002\u9019\u500b\u932f\u8aa4\u901a\u5e38\u8207\u6578\u64da\u985e\u578b\u7684\u8655\u7406\u6709\u95dc\uff0c\u7279\u5225\u662f\u5728\u4f7f\u7528\u51fd\u6578\u6216\u904b\u7b97\u6642\uff0c\u7576\u6307\u6a19\u8d85\u51fa\u5176\u53ef\u8868\u793a\u7684\u7bc4\u570d\u6642\u5c31\u6703\u767c\u751f\u6b64\u932f\u8aa4\u3002\u672c\u6587\u5c07\u6df1\u5165\u63a2\u8a0e\u9019\u500b\u932f\u8aa4\u7684\u539f\u56e0\u53ca\u5176\u89e3\u6c7a\u65b9\u6848\u3002<\/p>\n<h2 id=\"%e9%8c%af%e8%aa%a4%e4%bb%a3%e7%a2%bc22022%e7%9a%84%e5%8e%9f%e5%9b%a0-GfpSSXTNca\">\u932f\u8aa4\u4ee3\u78bc22022\u7684\u539f\u56e0<\/h2>\n<p>PostgreSQL\u7684\u932f\u8aa4\u4ee3\u78bc22022\u8868\u793a\u6307\u6a19\u6ea2\u51fa\uff0c\u9019\u901a\u5e38\u767c\u751f\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\u53ef\u80fd\u6703\u5c0e\u81f4\u6307\u6a19\u6ea2\u51fa\u3002\u4f8b\u5982\uff0c\u5c07\u4e00\u500b\u904e\u5927\u7684\u6574\u6578\u8f49\u63db\u70ba\u5c0f\u7bc4\u570d\u7684\u6574\u6578\u985e\u578b\u3002<\/li>\n<li><strong>\u51fd\u6578\u8fd4\u56de\u503c\u8d85\u51fa\u7bc4\u570d\uff1a<\/strong>\u67d0\u4e9b\u51fd\u6578\u5728\u8a08\u7b97\u904e\u7a0b\u4e2d\u53ef\u80fd\u6703\u8fd4\u56de\u8d85\u51fa\u5176\u5b9a\u7fa9\u7bc4\u570d\u7684\u503c\uff0c\u9019\u6703\u5c0e\u81f4\u6307\u6a19\u6ea2\u51fa\u3002<\/li>\n<li><strong>\u6578\u64da\u5eab\u8a2d\u8a08\u554f\u984c\uff1a<\/strong>\u4e0d\u7576\u7684\u6578\u64da\u5eab\u8a2d\u8a08\uff0c\u4f8b\u5982\u4f7f\u7528\u4e0d\u5408\u9069\u7684\u6578\u64da\u985e\u578b\u6216\u7f3a\u4e4f\u9069\u7576\u7684\u7d04\u675f\u689d\u4ef6\uff0c\u4e5f\u53ef\u80fd\u5c0e\u81f4\u6b64\u932f\u8aa4\u3002<\/li>\n<\/ul>\n<h2 id=\"%e5%a6%82%e4%bd%95%e4%bf%ae%e5%be%a922022%e9%8c%af%e8%aa%a4-GfpSSXTNca\">\u5982\u4f55\u4fee\u5fa922022\u932f\u8aa4<\/h2>\n<p>\u4fee\u5fa9PostgreSQL\u768422022\u932f\u8aa4\u9700\u8981\u91dd\u5c0d\u5177\u9ad4\u60c5\u6cc1\u9032\u884c\u8abf\u6574\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-GfpSSXTNca\">1. \u6aa2\u67e5\u6578\u64da\u985e\u578b<\/h3>\n<p>\u9996\u5148\uff0c\u6aa2\u67e5\u6d89\u53ca\u7684\u6578\u64da\u985e\u578b\u662f\u5426\u6b63\u78ba\u3002\u4f8b\u5982\uff0c\u5982\u679c\u4f60\u5728\u9032\u884c\u6578\u5b78\u904b\u7b97\u6642\u4f7f\u7528\u4e86\u6574\u6578\u985e\u578b\uff0c\u78ba\u4fdd\u6240\u6709\u53c3\u8207\u904b\u7b97\u7684\u6578\u64da\u90fd\u5728\u8a72\u985e\u578b\u7684\u7bc4\u570d\u5167\u3002\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0bSQL\u67e5\u8a62\u4f86\u6aa2\u67e5\u6578\u64da\u985e\u578b\uff1a<\/p>\n<pre><code>SELECT column_name, data_type \nFROM information_schema.columns \nWHERE table_name = 'your_table_name';<\/code><\/pre>\n<h3 id=\"2-%e4%bd%bf%e7%94%a8%e9%81%a9%e7%95%b6%e7%9a%84%e6%95%b8%e6%93%9a%e9%a1%9e%e5%9e%8b-GfpSSXTNca\">2. \u4f7f\u7528\u9069\u7576\u7684\u6578\u64da\u985e\u578b<\/h3>\n<p>\u5982\u679c\u767c\u73fe\u67d0\u4e9b\u5217\u7684\u6578\u64da\u985e\u578b\u4e0d\u5408\u9069\uff0c\u8003\u616e\u5c07\u5176\u66f4\u6539\u70ba\u66f4\u5408\u9069\u7684\u985e\u578b\u3002\u4f8b\u5982\uff0c\u5c07\u6574\u6578\u985e\u578b\u66f4\u6539\u70babigint\uff0c\u4ee5\u5bb9\u7d0d\u66f4\u5927\u7684\u6578\u503c\uff1a<\/p>\n<pre><code>ALTER TABLE your_table_name \nALTER COLUMN your_column_name TYPE bigint;<\/code><\/pre>\n<h3 id=\"3-%e6%aa%a2%e6%9f%a5%e5%87%bd%e6%95%b8%e7%9a%84%e8%bf%94%e5%9b%9e%e5%80%bc-GfpSSXTNca\">3. \u6aa2\u67e5\u51fd\u6578\u7684\u8fd4\u56de\u503c<\/h3>\n<p>\u5982\u679c\u932f\u8aa4\u767c\u751f\u5728\u51fd\u6578\u8abf\u7528\u4e2d\uff0c\u6aa2\u67e5\u8a72\u51fd\u6578\u7684\u908f\u8f2f\uff0c\u78ba\u4fdd\u5176\u8fd4\u56de\u503c\u4e0d\u6703\u8d85\u51fa\u9810\u671f\u7bc4\u570d\u3002\u53ef\u4ee5\u901a\u904e\u6dfb\u52a0\u908a\u754c\u6aa2\u67e5\u4f86\u9632\u6b62\u6b64\u985e\u554f\u984c\uff1a<\/p>\n<pre><code>CREATE OR REPLACE FUNCTION your_function_name() RETURNS integer AS $$\nBEGIN\n    -- \u4f60\u7684\u908f\u8f2f\n    IF result &gt; max_value THEN\n        RAISE EXCEPTION 'Result exceeds maximum value';\n    END IF;\n    RETURN result;\nEND;\n$$ LANGUAGE plpgsql;<\/code><\/pre>\n<h3 id=\"4-%e6%95%b8%e6%93%9a%e5%ba%ab%e8%a8%ad%e8%a8%88%e5%84%aa%e5%8c%96-GfpSSXTNca\">4. \u6578\u64da\u5eab\u8a2d\u8a08\u512a\u5316<\/h3>\n<p>\u6700\u5f8c\uff0c\u6aa2\u67e5\u6578\u64da\u5eab\u7684\u6574\u9ad4\u8a2d\u8a08\uff0c\u78ba\u4fdd\u4f7f\u7528\u4e86\u5408\u9069\u7684\u7d04\u675f\u689d\u4ef6\u548c\u6578\u64da\u985e\u578b\u3002\u9019\u4e0d\u50c5\u80fd\u9632\u6b6222022\u932f\u8aa4\uff0c\u9084\u80fd\u63d0\u9ad8\u6578\u64da\u5eab\u7684\u6027\u80fd\u548c\u7a69\u5b9a\u6027\u3002<\/p>\n<h2 id=\"%e7%b8%bd%e7%b5%90-GfpSSXTNca\">\u7e3d\u7d50<\/h2>\n<p>PostgreSQL\u932f\u8aa4\u4ee3\u78bc22022 &#8211; indicator_overflow\u901a\u5e38\u662f\u7531\u65bc\u6578\u64da\u985e\u578b\u4e0d\u5339\u914d\u6216\u51fd\u6578\u8fd4\u56de\u503c\u8d85\u51fa\u7bc4\u570d\u5f15\u8d77\u7684\u3002\u901a\u904e\u6aa2\u67e5\u6578\u64da\u985e\u578b\u3001\u4f7f\u7528\u9069\u7576\u7684\u6578\u64da\u985e\u578b\u3001\u6aa2\u67e5\u51fd\u6578\u7684\u8fd4\u56de\u503c\u4ee5\u53ca\u512a\u5316\u6578\u64da\u5eab\u8a2d\u8a08\uff0c\u53ef\u4ee5\u6709\u6548\u5730\u4fee\u5fa9\u6b64\u932f\u8aa4\u3002\u5c0d\u65bc\u9700\u8981\u7a69\u5b9a\u548c\u9ad8\u6548\u904b\u884c\u7684\u61c9\u7528\u7a0b\u5e8f\uff0c\u9078\u64c7\u5408\u9069\u7684 <a href=\"https:\/\/server.hk\">VPS<\/a> \u89e3\u6c7a\u65b9\u6848\u4e5f\u662f\u81f3\u95dc\u91cd\u8981\u7684\uff0c\u9019\u6a23\u53ef\u4ee5\u78ba\u4fdd\u6578\u64da\u5eab\u7684\u6027\u80fd\u548c\u53ef\u9760\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e86\u89e3\u5982\u4f55\u4fee\u5fa9PostgreSQL\u932f\u8aa4\u4ee3\u78bc22022 &#8211; indicator_overflow\uff0c\u89e3\u6c7a\u6307\u6a19\u6ea2\u51fa\u554f\u984c\uff0c\u78ba\u4fdd\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-178746","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/178746","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=178746"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/178746\/revisions"}],"predecessor-version":[{"id":178747,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/178746\/revisions\/178747"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=178746"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=178746"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=178746"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}