{"id":21331,"date":"2024-01-02T07:36:26","date_gmt":"2024-01-02T07:36:26","guid":{"rendered":"https:\/\/server.hk\/blog\/21331\/"},"modified":"2024-11-14T10:36:36","modified_gmt":"2024-11-14T02:36:36","slug":"how-to-fix-postgresql-error-code-22036-non_numeric_sql_json_item","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/21331\/","title":{"rendered":"\u5982\u4f55\u4fee\u5fa9 PostgreSQL \u932f\u8aa4\u4ee3\u78bc\uff1a22036 &#8211; non_numeric_sql_json_item"},"content":{"rendered":"<h1 id=\"how-to-fix-postgresql-error-code-22036-non_numeric_sql_json_item-xTBnfryhzg\">\u5982\u4f55\u4fee\u5fa9 PostgreSQL \u932f\u8aa4\u4ee3\u78bc\uff1a22036 &#8211; non_numeric_sql_json_item<\/h1>\n<p>PostgreSQL \u662f\u4e00\u6b3e\u529f\u80fd\u5f37\u5927\u7684\u958b\u6e90\u95dc\u806f\u5f0f\u6578\u64da\u5eab\u7ba1\u7406\u7cfb\u7d71\uff0c\u5ee3\u6cdb\u61c9\u7528\u65bc\u5404\u7a2e\u61c9\u7528\u7a0b\u5f0f\u3002\u7136\u800c\uff0c\u50cf\u4efb\u4f55\u8edf\u9ad4\u4e00\u6a23\uff0c\u5b83\u53ef\u80fd\u6703\u906d\u9047\u932f\u8aa4\uff0c\u9019\u4e9b\u932f\u8aa4\u53ef\u80fd\u6703\u59a8\u7919\u5176\u6b63\u5e38\u904b\u884c\u3002\u5176\u4e2d\u4e00\u500b\u932f\u8aa4\u662f PostgreSQL \u932f\u8aa4\u4ee3\u78bc\uff1a22036 &#8211; non_numeric_sql_json_item\u3002\u5728\u672c\u6587\u4e2d\uff0c\u6211\u5011\u5c07\u63a2\u8a0e\u6b64\u932f\u8aa4\u7684\u6210\u56e0\u4e26\u63d0\u4f9b\u9010\u6b65\u89e3\u6c7a\u65b9\u6848\u3002<\/p>\n<h2 id=\"understanding-the-error-xTBnfryhzg\">\u7406\u89e3\u932f\u8aa4<\/h2>\n<p>PostgreSQL \u932f\u8aa4\u4ee3\u78bc\uff1a22036 &#8211; non_numeric_sql_json_item \u767c\u751f\u65bc\u5617\u8a66\u4f7f\u7528 SQL \u8a2a\u554f JSON \u6578\u7d44\u4e2d\u7684\u975e\u6578\u5b57\u9805\u76ee\u6642\u3002\u9019\u7a2e\u932f\u8aa4\u901a\u5e38\u5728\u5c0d JSON \u6578\u64da\u985e\u578b\u9032\u884c\u64cd\u4f5c\u6642\u51fa\u73fe\uff0c\u4f8b\u5982\u63d0\u53d6\u503c\u6216\u64cd\u4f5c JSON \u6578\u7d44\u3002<\/p>\n<h2 id=\"possible-causes-xTBnfryhzg\">\u53ef\u80fd\u7684\u6210\u56e0<\/h2>\n<p>\u6b64\u932f\u8aa4\u6709\u5e7e\u500b\u6f5b\u5728\u539f\u56e0\uff1a<\/p>\n<ul>\n<li><strong>\u7121\u6548\u7684 JSON \u7d50\u69cb\uff1a<\/strong> \u88ab\u8a2a\u554f\u7684 JSON \u6578\u64da\u53ef\u80fd\u5b58\u5728\u7121\u6548\u7d50\u69cb\uff0c\u4f8b\u5982\u7f3a\u5931\u6216\u4e0d\u5339\u914d\u7684\u62ec\u865f\u3001\u5f15\u865f\u6216\u9017\u865f\u3002<\/li>\n<li><strong>\u4e0d\u6b63\u78ba\u7684 SQL \u8a9e\u6cd5\uff1a<\/strong> \u7528\u65bc\u8a2a\u554f JSON \u6578\u64da\u7684 SQL \u67e5\u8a62\u53ef\u80fd\u5305\u542b\u8a9e\u6cd5\u932f\u8aa4\u6216\u4e0d\u6b63\u78ba\u7684 JSON \u51fd\u6578\u4f7f\u7528\u3002<\/li>\n<li><strong>\u4e0d\u652f\u63f4\u7684 JSON \u64cd\u4f5c\uff1a<\/strong> \u67d0\u4e9b JSON \u64cd\u4f5c\u53ef\u80fd\u4e0d\u88ab\u4f7f\u7528\u7684 PostgreSQL \u7248\u672c\u6240\u652f\u63f4\u3002<\/li>\n<\/ul>\n<h2 id=\"fixing-the-error-xTBnfryhzg\">\u4fee\u5fa9\u932f\u8aa4<\/h2>\n<p>\u8981\u4fee\u5fa9 PostgreSQL \u932f\u8aa4\u4ee3\u78bc\uff1a22036 &#8211; non_numeric_sql_json_item\uff0c\u8acb\u9075\u5faa\u4ee5\u4e0b\u6b65\u9a5f\uff1a<\/p>\n<h3 id=\"1-validate-json-structure-xTBnfryhzg\">1. \u9a57\u8b49 JSON \u7d50\u69cb<\/h3>\n<p>\u78ba\u4fdd\u6b63\u5728\u8a2a\u554f\u7684 JSON \u6578\u64da\u5177\u6709\u6709\u6548\u7684\u7d50\u69cb\u3002\u6aa2\u67e5\u662f\u5426\u5b58\u5728\u7f3a\u5931\u6216\u4e0d\u5339\u914d\u7684\u62ec\u865f\u3001\u5f15\u865f\u6216\u9017\u865f\u3002\u4f7f\u7528\u5728\u7dda JSON \u9a57\u8b49\u5de5\u5177\u4f86\u9a57\u8b49 JSON \u7d50\u69cb\u3002<\/p>\n<h3 id=\"2-verify-sql-syntax-xTBnfryhzg\">2. \u9a57\u8b49 SQL \u8a9e\u6cd5<\/h3>\n<p>\u6aa2\u67e5\u7528\u65bc\u8a2a\u554f JSON \u6578\u64da\u7684 SQL \u67e5\u8a62\u3002\u67e5\u770b\u662f\u5426\u5b58\u5728\u8a9e\u6cd5\u932f\u8aa4\u6216\u4e0d\u6b63\u78ba\u4f7f\u7528\u7684 JSON \u51fd\u6578\u3002\u53c3\u8003 PostgreSQL \u6587\u6a94\u4ee5\u7372\u53d6\u6b63\u78ba\u7684\u8a9e\u6cd5\u548c JSON \u51fd\u6578\u7684\u4f7f\u7528\u65b9\u6cd5\u3002<\/p>\n<h3 id=\"3-update-postgresql-version-xTBnfryhzg\">3. \u66f4\u65b0 PostgreSQL \u7248\u672c<\/h3>\n<p>\u5982\u679c\u60a8\u6b63\u5728\u4f7f\u7528\u8f03\u820a\u7684 PostgreSQL \u7248\u672c\uff0c\u8003\u616e\u5347\u7d1a\u81f3\u6700\u65b0\u7248\u672c\u3002\u8f03\u65b0\u7248\u672c\u901a\u5e38\u5305\u542b\u932f\u8aa4\u4fee\u6b63\u548c\u6539\u9032\uff0c\u9019\u53ef\u80fd\u89e3\u6c7a\u8a72\u932f\u8aa4\u3002<\/p>\n<h3 id=\"4-use-appropriate-json-functions-xTBnfryhzg\">4. \u4f7f\u7528\u9069\u7576\u7684 JSON \u51fd\u6578<\/h3>\n<p>\u78ba\u4fdd\u60a8\u4f7f\u7528\u7684 JSON \u51fd\u6578\u9069\u5408\u6240\u9700\u7684\u64cd\u4f5c\u3002\u53c3\u8003 PostgreSQL \u6587\u6a94\u4ee5\u7372\u53d6\u652f\u6301\u7684 JSON \u51fd\u6578\u53ca\u5176\u4f7f\u7528\u65b9\u6cd5\u7684\u5217\u8868\u3002<\/p>\n<h3 id=\"5-test-with-sample-data-xTBnfryhzg\">5. \u4f7f\u7528\u793a\u7bc4\u6578\u64da\u9032\u884c\u6e2c\u8a66<\/h3>\n<p>\u5982\u6709\u53ef\u80fd\uff0c\u5275\u5efa\u4e00\u500b\u5305\u542b\u793a\u7bc4\u6578\u64da\u7684\u6e2c\u8a66\u74b0\u5883\uff0c\u4ee5\u91cd\u73fe\u8a72\u932f\u8aa4\u3002\u9019\u5c07\u6709\u52a9\u65bc\u8b58\u5225\u5177\u9ad4\u6210\u56e0\u4e26\u627e\u5230\u89e3\u6c7a\u65b9\u6848\u3002<\/p>\n<h3 id=\"6-seek-community-support-xTBnfryhzg\">6. \u5c0b\u6c42\u793e\u5340\u652f\u6301<\/h3>\n<p>\u5982\u679c\u932f\u8aa4\u6301\u7e8c\u5b58\u5728\uff0c\u8acb\u5411 PostgreSQL \u793e\u5340\u5c0b\u6c42\u5e6b\u52a9\u3002\u5728\u8ad6\u58c7\u6216\u90f5\u4ef6\u5217\u8868\u4e0a\u767c\u4f48\u60a8\u7684\u554f\u984c\uff0c\u4e26\u63d0\u4f9b\u76f8\u95dc\u7d30\u7bc0\uff0c\u4f8b\u5982 PostgreSQL \u7248\u672c\u3001SQL \u67e5\u8a62\u548c\u793a\u7bc4\u6578\u64da\u3002\u7d93\u9a57\u8c50\u5bcc\u7684\u7528\u6236\u548c\u958b\u767c\u8005\u53ef\u4ee5\u63d0\u4f9b\u5bf6\u8cb4\u7684\u898b\u89e3\u548c\u5e6b\u52a9\u3002<\/p>\n<h2 id=\"summary-xTBnfryhzg\">\u7e3d\u7d50<\/h2>\n<p>\u7e3d\u4e4b\uff0cPostgreSQL \u932f\u8aa4\u4ee3\u78bc\uff1a22036 &#8211; non_numeric_sql_json_item \u53ef\u4ee5\u901a\u904e\u9a57\u8b49 JSON \u7d50\u69cb\u3001\u6aa2\u67e5 SQL \u8a9e\u6cd5\u3001\u66f4\u65b0 PostgreSQL \u7248\u672c\u3001\u4f7f\u7528\u9069\u7576\u7684 JSON \u51fd\u6578\u3001\u4f7f\u7528\u793a\u7bc4\u6578\u64da\u9032\u884c\u6e2c\u8a66\u4ee5\u53ca\u5c0b\u6c42\u793e\u5340\u652f\u6301\u4f86\u89e3\u6c7a\u3002\u901a\u904e\u9075\u5faa\u9019\u4e9b\u6b65\u9a5f\uff0c\u60a8\u53ef\u4ee5\u514b\u670d\u6b64\u932f\u8aa4\uff0c\u78ba\u4fdd\u60a8\u7684 PostgreSQL \u6578\u64da\u5eab\u9806\u5229\u904b\u884c\u3002<\/p>\n<p>\u5982\u9700\u53ef\u9760\u4e14\u9ad8\u6027\u80fd\u7684 VPS \u8a17\u7ba1\u89e3\u6c7a\u65b9\u6848\uff0c\u8acb\u8003\u616e <a href=\"https:\/\/server.hk\">Server.HK<\/a>\u3002\u6211\u5011\u7684\u9999\u6e2f VPS \u8a17\u7ba1\u670d\u52d9\u70ba\u60a8\u7684\u5546\u696d\u9700\u6c42\u63d0\u4f9b\u4e00\u6d41\u7684\u6027\u80fd\u548c\u53ef\u9760\u6027\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":[4925],"tags":[],"class_list":["post-21331","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/21331","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=21331"}],"version-history":[{"count":2,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/21331\/revisions"}],"predecessor-version":[{"id":24178,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/21331\/revisions\/24178"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=21331"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=21331"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=21331"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}