{"id":20802,"date":"2024-01-02T06:11:23","date_gmt":"2024-01-02T06:11:23","guid":{"rendered":"https:\/\/server.hk\/blog\/20802\/"},"modified":"2024-11-14T10:38:23","modified_gmt":"2024-11-14T02:38:23","slug":"how-to-fix-postgresql-error-code-01008-implicit_zero_bit_padding","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/20802\/","title":{"rendered":"\u5982\u4f55\u4fee\u5fa9 PostgreSQL \u932f\u8aa4\u4ee3\u78bc\uff1a01008 &#8211; implicit_zero_bit_padding"},"content":{"rendered":"<h1 id=\"how-to-fix-postgresql-error-code-01008-implicit_zero_bit_padding-vDbGgcqMgt\">\u5982\u4f55\u4fee\u5fa9 PostgreSQL \u932f\u8aa4\u4ee3\u78bc\uff1a01008 &#8211; implicit_zero_bit_padding<\/h1>\n<p>PostgreSQL \u662f\u4e00\u500b\u5f37\u5927\u7684\u958b\u6e90\u95dc\u806f\u6578\u64da\u5eab\u7ba1\u7406\u7cfb\u7d71\uff0c\u5ee3\u6cdb\u7528\u65bc\u5404\u7a2e\u61c9\u7528\u3002\u7136\u800c\uff0c\u50cf\u4efb\u4f55\u8edf\u4ef6\u4e00\u6a23\uff0c\u5b83\u53ef\u80fd\u6703\u9047\u5230\u9700\u8981\u89e3\u6c7a\u7684\u932f\u8aa4\u3002\u5176\u4e2d\u4e00\u500b\u932f\u8aa4\u662f PostgreSQL \u932f\u8aa4\u4ee3\u78bc\uff1a01008 &#8211; implicit_zero_bit_padding\u3002\u5728\u672c\u6587\u4e2d\uff0c\u6211\u5011\u5c07\u63a2\u8a0e\u6b64\u932f\u8aa4\u7684\u542b\u7fa9\u4e26\u63d0\u4f9b\u4fee\u5fa9\u6b65\u9a5f\u3002<\/p>\n<h2 id=\"understanding-the-postgresql-error-code-01008-vDbGgcqMgt\">\u7406\u89e3 PostgreSQL \u932f\u8aa4\u4ee3\u78bc\uff1a01008<\/h2>\n<p>PostgreSQL \u932f\u8aa4\u4ee3\u78bc\uff1a01008 &#8211; implicit_zero_bit_padding \u7576\u5617\u8a66\u5c07\u5177\u6709\u96b1\u5f0f\u96f6\u4f4d\u586b\u5145\u7684\u6578\u64da\u985e\u578b\u8f49\u63db\u70ba\u6c92\u6709\u96b1\u5f0f\u96f6\u4f4d\u586b\u5145\u7684\u6578\u64da\u985e\u578b\u6642\u767c\u751f\u3002\u9019\u500b\u932f\u8aa4\u901a\u5e38\u5728\u5c07\u6578\u64da\u5f9e\u4e00\u500b\u8868\u9077\u79fb\u5230\u53e6\u4e00\u500b\u8868\u6216\u5728\u57f7\u884c\u6d89\u53ca\u6578\u64da\u985e\u578b\u8f49\u63db\u7684\u64cd\u4f5c\u6642\u51fa\u73fe\u3002<\/p>\n<p>\u96b1\u5f0f\u96f6\u4f4d\u586b\u5145\u6307\u7684\u662f\u81ea\u52d5\u5411\u6578\u64da\u985e\u578b\u6dfb\u52a0\u984d\u5916\u4f4d\u5143\uff0c\u4ee5\u4f7f\u5176\u8207\u5167\u5b58\u5b58\u5132\u8981\u6c42\u5c0d\u9f4a\u3002\u9019\u7a2e\u586b\u5145\u78ba\u4fdd\u6578\u64da\u9ad8\u6548\u5b58\u5132\u4e26\u80fd\u5feb\u901f\u8a2a\u554f\u3002\u7136\u800c\uff0c\u7576\u5617\u8a66\u5c07\u5177\u6709\u96b1\u5f0f\u96f6\u4f4d\u586b\u5145\u7684\u6578\u64da\u985e\u578b\u8f49\u63db\u70ba\u6c92\u6709\u96b1\u5f0f\u96f6\u4f4d\u586b\u5145\u7684\u6578\u64da\u985e\u578b\u6642\uff0cPostgreSQL \u6703\u62cb\u51fa 01008 \u932f\u8aa4\u3002<\/p>\n<h2 id=\"fixing-the-postgresql-error-code-01008-vDbGgcqMgt\">\u4fee\u5fa9 PostgreSQL \u932f\u8aa4\u4ee3\u78bc\uff1a01008<\/h2>\n<p>\u8981\u4fee\u5fa9 PostgreSQL \u932f\u8aa4\u4ee3\u78bc\uff1a01008 &#8211; implicit_zero_bit_padding\uff0c\u60a8\u53ef\u4ee5\u6309\u7167\u4ee5\u4e0b\u6b65\u9a5f\u64cd\u4f5c\uff1a<\/p>\n<h3 id=\"step-1-identify-the-affected-columns-vDbGgcqMgt\">\u6b65\u9a5f 1\uff1a\u8b58\u5225\u53d7\u5f71\u97ff\u7684\u5217<\/h3>\n<p>\u9996\u5148\uff0c\u60a8\u9700\u8981\u8b58\u5225\u6578\u64da\u5eab\u4e2d\u5c0e\u81f4\u932f\u8aa4\u7684\u5217\u3002\u60a8\u53ef\u4ee5\u901a\u904e\u6aa2\u67e5\u932f\u8aa4\u6d88\u606f\u6216\u5be9\u67e5\u89f8\u767c\u932f\u8aa4\u7684\u4ee3\u78bc\u4f86\u5b8c\u6210\u6b64\u64cd\u4f5c\u3002\u67e5\u627e\u4efb\u4f55\u6578\u64da\u985e\u578b\u8f49\u63db\u6216\u6d89\u53ca\u96b1\u5f0f\u96f6\u4f4d\u586b\u5145\u7684\u6578\u64da\u985e\u578b\u7684\u64cd\u4f5c\u3002<\/p>\n<h3 id=\"step-2-modify-the-data-types-vDbGgcqMgt\">\u6b65\u9a5f 2\uff1a\u4fee\u6539\u6578\u64da\u985e\u578b<\/h3>\n<p>\u4e00\u65e6\u8b58\u5225\u51fa\u53d7\u5f71\u97ff\u7684\u5217\uff0c\u60a8\u53ef\u4ee5\u4fee\u6539\u6578\u64da\u985e\u578b\u4ee5\u89e3\u6c7a\u932f\u8aa4\u3002\u60a8\u6709\u5169\u500b\u9078\u64c7\uff1a<\/p>\n<ul>\n<li><strong>\u9078\u64c7 1\uff1a<\/strong>\u5c07\u76ee\u6a19\u5217\u7684\u6578\u64da\u985e\u578b\u66f4\u6539\u70ba\u8207\u6e90\u5217\u7684\u6578\u64da\u985e\u578b\u5339\u914d\u3002\u9019\u78ba\u4fdd\u5169\u500b\u5217\u5177\u6709\u76f8\u540c\u7684\u6578\u64da\u985e\u578b\uff0c\u5305\u62ec\u4efb\u4f55\u96b1\u5f0f\u96f6\u4f4d\u586b\u5145\u3002<\/li>\n<li><strong>\u9078\u64c7 2\uff1a<\/strong>\u5f9e\u6e90\u5217\u7684\u6578\u64da\u985e\u578b\u4e2d\u522a\u9664\u96b1\u5f0f\u96f6\u4f4d\u586b\u5145\u3002\u9019\u53ef\u4ee5\u901a\u904e\u66f4\u6539\u5217\u7684\u6578\u64da\u985e\u578b\u4e26\u6307\u5b9a\u9069\u7576\u7684\u9577\u5ea6\u6216\u7cbe\u5ea6\u800c\u4e0d\u5e36\u586b\u5145\u4f86\u5b8c\u6210\u3002<\/li>\n<\/ul>\n<p>\u9078\u64c7\u6700\u9069\u5408\u60a8\u9700\u6c42\u7684\u9078\u9805\uff0c\u4e26\u5c0d\u53d7\u5f71\u97ff\u7684\u5217\u9032\u884c\u5fc5\u8981\u7684\u4fee\u6539\u3002<\/p>\n<h3 id=\"step-3-migrate-the-data-vDbGgcqMgt\">\u6b65\u9a5f 3\uff1a\u9077\u79fb\u6578\u64da<\/h3>\n<p>\u5728\u4fee\u6539\u6578\u64da\u985e\u578b\u5f8c\uff0c\u60a8\u9700\u8981\u5c07\u6578\u64da\u5f9e\u6e90\u5217\u9077\u79fb\u5230\u76ee\u6a19\u5217\u3002\u9019\u53ef\u4ee5\u4f7f\u7528 SQL \u8a9e\u53e5\uff0c\u4f8b\u5982 INSERT INTO \u6216 UPDATE\uff0c\u5177\u9ad4\u53d6\u6c7a\u65bc\u60a8\u7684\u60c5\u6cc1\u3002<\/p>\n<p>\u78ba\u4fdd\u6578\u64da\u6e96\u78ba\u8f49\u79fb\uff0c\u4e26\u9a57\u8b49\u7d50\u679c\u4ee5\u78ba\u8a8d PostgreSQL \u932f\u8aa4\u4ee3\u78bc\uff1a01008 &#8211; implicit_zero_bit_padding \u5df2\u7d93\u89e3\u6c7a\u3002<\/p>\n<h2 id=\"summary-vDbGgcqMgt\">\u7e3d\u7d50<\/h2>\n<p>\u7e3d\u4e4b\uff0cPostgreSQL \u932f\u8aa4\u4ee3\u78bc\uff1a01008 &#8211; implicit_zero_bit_padding \u767c\u751f\u5728\u5617\u8a66\u5c07\u5177\u6709\u96b1\u5f0f\u96f6\u4f4d\u586b\u5145\u7684\u6578\u64da\u985e\u578b\u8f49\u63db\u70ba\u6c92\u6709\u96b1\u5f0f\u96f6\u4f4d\u586b\u5145\u7684\u6578\u64da\u985e\u578b\u6642\u3002\u8981\u4fee\u5fa9\u6b64\u932f\u8aa4\uff0c\u60a8\u9700\u8981\u8b58\u5225\u53d7\u5f71\u97ff\u7684\u5217\uff0c\u4fee\u6539\u6578\u64da\u985e\u578b\u4ee5\u5339\u914d\u6216\u522a\u9664\u586b\u5145\uff0c\u4e26\u76f8\u61c9\u5730\u9077\u79fb\u6578\u64da\u3002\u901a\u904e\u9075\u5faa\u9019\u4e9b\u6b65\u9a5f\uff0c\u60a8\u53ef\u4ee5\u89e3\u6c7a PostgreSQL \u932f\u8aa4\u4ee3\u78bc\uff1a01008\uff0c\u4e26\u78ba\u4fdd PostgreSQL \u6578\u64da\u5eab\u7684\u9806\u5229\u904b\u884c\u3002<\/p>\n<p>\u5982\u9700\u6709\u95dc VPS \u8a17\u7ba1\u89e3\u6c7a\u65b9\u6848\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u8003\u616e <a href=\"https:\/\/server.hk\">Server.HK<\/a>\u3002\u6211\u5011\u53ef\u9760\u4e14\u9ad8\u6027\u80fd\u7684 VPS \u8a17\u7ba1\u670d\u52d9\u53ef\u4ee5\u6eff\u8db3\u60a8\u7684\u5177\u9ad4\u9700\u6c42\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u4fee\u5fa9 PostgreSQL &#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4924],"tags":[],"class_list":["post-20802","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/20802","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"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=20802"}],"version-history":[{"count":2,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/20802\/revisions"}],"predecessor-version":[{"id":24290,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/20802\/revisions\/24290"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=20802"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=20802"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=20802"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}