{"id":21336,"date":"2024-01-02T07:41:24","date_gmt":"2024-01-02T07:41:24","guid":{"rendered":"https:\/\/server.hk\/blog\/21336\/"},"modified":"2024-11-14T10:36:30","modified_gmt":"2024-11-14T02:36:30","slug":"how-to-fix-postgresql-error-code-2203b-sql_json_number_not_found","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/21336\/","title":{"rendered":"\u5982\u4f55\u4fee\u5fa9 PostgreSQL \u932f\u8aa4\u4ee3\u78bc\uff1a2203B &#8211; sql_json_number_not_found"},"content":{"rendered":"<h1 id=\"how-to-fix-postgresql-error-code-2203b-sql_json_number_not_found-iFSJsoUBFg\">\u5982\u4f55\u4fee\u5fa9 PostgreSQL \u932f\u8aa4\u4ee3\u78bc\uff1a2203B &#8211; sql_json_number_not_found<\/h1>\n<p>PostgreSQL \u662f\u4e00\u500b\u529f\u80fd\u5f37\u5927\u7684\u958b\u6e90\u95dc\u806f\u6578\u64da\u5eab\u7ba1\u7406\u7cfb\u7d71\uff0c\u5ee3\u6cdb\u7528\u65bc\u5404\u7a2e\u61c9\u7528\u7a0b\u5e8f\u3002\u7136\u800c\uff0c\u50cf\u4efb\u4f55\u8edf\u4ef6\u4e00\u6a23\uff0c\u5b83\u4e5f\u53ef\u80fd\u9047\u5230\u6703\u5e72\u64fe\u6b63\u5e38\u904b\u884c\u7684\u932f\u8aa4\u3002\u5176\u4e2d\u4e00\u500b\u932f\u8aa4\u662f PostgreSQL \u932f\u8aa4\u4ee3\u78bc\uff1a2203B &#8211; sql_json_number_not_found\u3002\u5728\u672c\u6587\u4e2d\uff0c\u6211\u5011\u5c07\u63a2\u8a0e\u6b64\u932f\u8aa4\u7684\u539f\u56e0\u4e26\u63d0\u4f9b\u9010\u6b65\u89e3\u6c7a\u65b9\u6848\u4f86\u4fee\u5fa9\u5b83\u3002<\/p>\n<h2 id=\"understanding-the-error-iFSJsoUBFg\">\u4e86\u89e3\u932f\u8aa4<\/h2>\n<p>PostgreSQL \u932f\u8aa4\u4ee3\u78bc\uff1a2203B &#8211; sql_json_number_not_found \u767c\u751f\u5728 JSON \u6587\u6a94\u4e2d\u627e\u4e0d\u5230\u6216\u7121\u6cd5\u8b58\u5225 JSON \u6578\u5b57\u6642\u3002\u9019\u500b\u932f\u8aa4\u901a\u5e38\u51fa\u73fe\u5728\u5c0d JSON \u6578\u64da\u985e\u578b\u57f7\u884c\u64cd\u4f5c\u6642\uff0c\u4f8b\u5982\u63d2\u5165\u6216\u66f4\u65b0 JSON \u503c\u3002<\/p>\n<p>\u7576\u6b64\u932f\u8aa4\u767c\u751f\u6642\uff0cPostgreSQL \u6703\u62cb\u51fa\u7570\u5e38\u4e26\u7d42\u6b62\u7576\u524d\u4e8b\u52d9\u3002\u53ca\u6642\u8655\u7406\u6b64\u932f\u8aa4\u5c0d\u65bc\u78ba\u4fdd\u6578\u64da\u5eab\u7684\u5b8c\u6574\u6027\u548c\u4e00\u81f4\u6027\u975e\u5e38\u91cd\u8981\u3002<\/p>\n<h2 id=\"possible-causes-iFSJsoUBFg\">\u53ef\u80fd\u539f\u56e0<\/h2>\n<p>PostgreSQL \u932f\u8aa4\u4ee3\u78bc\uff1a2203B &#8211; sql_json_number_not_found \u7684\u6f5b\u5728\u539f\u56e0\u6709\u5e7e\u500b\uff1a<\/p>\n<ul>\n<li><strong>\u7121\u6548\u7684 JSON \u6578\u64da\uff1a<\/strong>\u5982\u679c\u6b63\u5728\u8655\u7406\u7684 JSON \u6578\u64da\u5305\u542b\u7121\u6548\u6216\u683c\u5f0f\u932f\u8aa4\u7684 JSON \u8a9e\u6cd5\uff0c\u5247\u53ef\u80fd\u6703\u767c\u751f\u6b64\u932f\u8aa4\u3002<\/li>\n<li><strong>\u4e0d\u6b63\u78ba\u7684 JSON \u8def\u5f91\uff1a<\/strong>\u5982\u679c\u60a8\u4f7f\u7528 JSON \u8def\u5f91\u8868\u9054\u5f0f\u4f86\u8a2a\u554f JSON \u6587\u6a94\u4e2d\u7684\u7279\u5b9a\u5143\u7d20\uff0c\u5247\u4e0d\u6b63\u78ba\u6216\u4e0d\u5b58\u5728\u7684\u8def\u5f91\u53ef\u80fd\u6703\u89f8\u767c\u6b64\u932f\u8aa4\u3002<\/li>\n<li><strong>\u7248\u672c\u4e0d\u517c\u5bb9\uff1a<\/strong>\u5982\u679c\u60a8\u4f7f\u7528\u7684 PostgreSQL \u7248\u672c\u904e\u820a\uff0c\u53ef\u80fd\u4e0d\u652f\u6301\u67d0\u4e9b JSON \u51fd\u6578\u6216\u904b\u7b97\u7b26\uff0c\u9019\u53ef\u80fd\u6703\u5c0e\u81f4\u6b64\u932f\u8aa4\u3002<\/li>\n<\/ul>\n<h2 id=\"fixing-the-error-iFSJsoUBFg\">\u4fee\u5fa9\u932f\u8aa4<\/h2>\n<p>\u8981\u89e3\u6c7a PostgreSQL \u932f\u8aa4\u4ee3\u78bc\uff1a2203B &#8211; sql_json_number_not_found\uff0c\u8acb\u6309\u7167\u4ee5\u4e0b\u6b65\u9a5f\u64cd\u4f5c\uff1a<\/p>\n<h3 id=\"1-validate-json-data-iFSJsoUBFg\">1. \u9a57\u8b49 JSON \u6578\u64da<\/h3>\n<p>\u78ba\u4fdd\u6b63\u5728\u8655\u7406\u7684 JSON \u6578\u64da\u662f\u6709\u6548\u7684\u4e26\u9075\u5faa JSON \u8a9e\u6cd5\u898f\u5247\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u5728\u7dda JSON \u9a57\u8b49\u5668\u6216\u5167\u7f6e\u7684 PostgreSQL \u51fd\u6578\uff0c\u4f8b\u5982 <code>json_valid<\/code> \u4f86\u9a57\u8b49 JSON \u6578\u64da\u3002<\/p>\n<h3 id=\"2-verify-json-path-iFSJsoUBFg\">2. \u9a57\u8b49 JSON \u8def\u5f91<\/h3>\n<p>\u5982\u679c\u60a8\u4f7f\u7528 JSON \u8def\u5f91\u8868\u9054\u5f0f\uff0c\u8acb\u4ed4\u7d30\u6aa2\u67e5\u8a72\u8def\u5f91\u4ee5\u78ba\u4fdd\u5176\u6b63\u78ba\u4e26\u6307\u5411\u73fe\u6709\u7684 JSON \u5143\u7d20\u3002\u4e0d\u6b63\u78ba\u7684\u8def\u5f91\u53ef\u80fd\u5c0e\u81f4\u932f\u8aa4\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528 <code>jsonb_path_exists<\/code> \u51fd\u6578\u4f86\u9a57\u8b49\u8a72\u8def\u5f91\u3002<\/p>\n<h3 id=\"3-upgrade-postgresql-iFSJsoUBFg\">3. \u5347\u7d1a PostgreSQL<\/h3>\n<p>\u5982\u679c\u60a8\u4f7f\u7528\u7684\u662f\u820a\u7248\u672c\u7684 PostgreSQL\uff0c\u8003\u616e\u5347\u7d1a\u5230\u652f\u6301\u6240\u9700 JSON \u51fd\u6578\u548c\u904b\u7b97\u7b26\u7684\u65b0\u7248\u672c\u3002\u5347\u7d1a\u53ef\u4ee5\u5e6b\u52a9\u89e3\u6c7a\u517c\u5bb9\u6027\u554f\u984c\uff0c\u4e26\u63d0\u4f9b\u984d\u5916\u7684\u529f\u80fd\u548c\u932f\u8aa4\u4fee\u5fa9\u3002<\/p>\n<h2 id=\"summary-iFSJsoUBFg\">\u7e3d\u7d50<\/h2>\n<p>\u7e3d\u4e4b\uff0cPostgreSQL \u932f\u8aa4\u4ee3\u78bc\uff1a2203B &#8211; sql_json_number_not_found \u53ef\u80fd\u7531\u65bc\u7121\u6548\u7684 JSON \u6578\u64da\u3001\u4e0d\u6b63\u78ba\u7684 JSON \u8def\u5f91\u6216\u7248\u672c\u4e0d\u517c\u5bb9\u800c\u767c\u751f\u3002\u8981\u4fee\u5fa9\u6b64\u932f\u8aa4\uff0c\u8acb\u9a57\u8b49 JSON \u6578\u64da\u3001\u6aa2\u67e5 JSON \u8def\u5f91\uff0c\u4e26\u5728\u5fc5\u8981\u6642\u8003\u616e\u5347\u7d1a PostgreSQL\u3002<\/p>\n<p>\u5c0d\u65bc\u53ef\u9760\u4e14\u9ad8\u6548\u7684 VPS \u8a17\u7ba1\u89e3\u6c7a\u65b9\u6848\uff0c\u8003\u616e <a href=\"https:\/\/server.hk\">Server.HK<\/a>\u3002\u6211\u5011\u7684\u9999\u6e2f VPS \u8a17\u7ba1\u670d\u52d9\u70ba\u60a8\u7684 PostgreSQL \u548c\u5176\u4ed6\u6578\u64da\u5eab\u9700\u6c42\u63d0\u4f9b\u5353\u8d8a\u7684\u6027\u80fd\u548c\u53ef\u9760\u6027\u3002<\/p>\n<p>&#8220;`<\/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":[4925],"tags":[],"class_list":["post-21336","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/21336","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=21336"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/21336\/revisions"}],"predecessor-version":[{"id":24171,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/21336\/revisions\/24171"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=21336"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=21336"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=21336"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}