{"id":21358,"date":"2024-01-02T08:03:22","date_gmt":"2024-01-02T08:03:22","guid":{"rendered":"https:\/\/server.hk\/blog\/21358\/"},"modified":"2024-11-14T10:36:02","modified_gmt":"2024-11-14T02:36:02","slug":"how-to-fix-postgresql-error-code-25007-schema_and_data_statement_mixing_not_supported","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/21358\/","title":{"rendered":"\u5982\u4f55\u4fee\u5fa9 PostgreSQL \u932f\u8aa4\u4ee3\u78bc\uff1a25007 &#8211; schema_and_data_statement_mixing_not_supported"},"content":{"rendered":"<h1>\u5982\u4f55\u4fee\u5fa9 PostgreSQL \u932f\u8aa4\u4ee3\u78bc\uff1a25007 &#8211; schema_and_data_statement_mixing_not_supported<\/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\u53ef\u80fd\u6703\u9047\u5230\u932f\u8aa4\uff0c\u9019\u4e9b\u932f\u8aa4\u53ef\u80fd\u6703\u5e72\u64fe\u5176\u6b63\u5e38\u904b\u884c\u3002\u5176\u4e2d\u4e00\u500b\u932f\u8aa4\u662f PostgreSQL \u932f\u8aa4\u4ee3\u78bc\uff1a25007 &#8211; schema_and_data_statement_mixing_not_supported\u3002\u5728\u672c\u6587\u4e2d\uff0c\u6211\u5011\u5c07\u63a2\u8a0e\u6b64\u932f\u8aa4\u7684\u539f\u56e0\u4e26\u63d0\u4f9b\u89e3\u6c7a\u65b9\u6848\u4f86\u4fee\u5fa9\u5b83\u3002<\/p>\n<h2>PostgreSQL \u932f\u8aa4\u4ee3\u78bc\uff1a25007 &#8211; schema_and_data_statement_mixing_not_supported \u7684\u539f\u56e0<\/h2>\n<p>\u7576\u5617\u8a66\u5728\u55ae\u500b\u4ea4\u6613\u4e2d\u6df7\u5408\u6a21\u5f0f\u548c\u6578\u64da\u8a9e\u53e5\u6642\uff0c\u5c31\u6703\u767c\u751f\u6b64\u932f\u8aa4\u3002PostgreSQL \u4e0d\u652f\u6301\u5728\u540c\u4e00\u4ea4\u6613\u4e2d\u6df7\u5408\u6a21\u5f0f\u548c\u6578\u64da\u8a9e\u53e5\uff0c\u56e0\u70ba\u9019\u53ef\u80fd\u5c0e\u81f4\u4e0d\u4e00\u81f4\u6027\u548c\u6578\u64da\u5b8c\u6574\u6027\u554f\u984c\u3002\u8a72\u932f\u8aa4\u6d88\u606f\u88ab\u89f8\u767c\u4ee5\u9632\u6b62\u6b64\u985e\u6df7\u5408\uff0c\u4e26\u78ba\u4fdd\u6578\u64da\u5eab\u7684\u53ef\u9760\u6027\u3002<\/p>\n<h2>\u4fee\u5fa9 PostgreSQL \u932f\u8aa4\u4ee3\u78bc\uff1a25007 &#8211; schema_and_data_statement_mixing_not_supported \u7684\u89e3\u6c7a\u65b9\u6848<\/h2>\n<ol>\n<li><strong>\u5206\u958b\u6a21\u5f0f\u548c\u6578\u64da\u8a9e\u53e5\uff1a<\/strong>\u6700\u7c21\u55ae\u7684\u89e3\u6c7a\u65b9\u6848\u662f\u5c07\u6a21\u5f0f\u548c\u6578\u64da\u8a9e\u53e5\u5206\u958b\u5230\u4e0d\u540c\u7684\u4ea4\u6613\u4e2d\u3002\u901a\u904e\u5728\u4e00\u500b\u4ea4\u6613\u4e2d\u57f7\u884c\u8207\u6a21\u5f0f\u76f8\u95dc\u7684\u8a9e\u53e5\uff0c\u800c\u5728\u53e6\u4e00\u500b\u4ea4\u6613\u4e2d\u57f7\u884c\u8207\u6578\u64da\u76f8\u95dc\u7684\u8a9e\u53e5\uff0c\u60a8\u53ef\u4ee5\u907f\u514d\u932f\u8aa4\u3002\u9019\u78ba\u4fdd\u4e86\u5728\u9032\u884c\u4efb\u4f55\u6578\u64da\u4fee\u6539\u4e4b\u524d\uff0c\u6a21\u5f0f\u66f4\u6539\u5df2\u88ab\u63d0\u4ea4\u3002<\/li>\n<li><strong>\u4f7f\u7528\u986f\u5f0f\u4ea4\u6613\uff1a<\/strong>\u53e6\u4e00\u7a2e\u65b9\u6cd5\u662f\u4f7f\u7528\u986f\u5f0f\u4ea4\u6613\uff0c\u4e26\u660e\u78ba\u63d0\u4ea4\u6216\u56de\u6efe\u6bcf\u500b\u4ea4\u6613\u3002\u901a\u904e\u5c07\u6a21\u5f0f\u548c\u6578\u64da\u8a9e\u53e5\u5305\u88f9\u5728\u55ae\u7368\u7684 BEGIN \u548c COMMIT\/ROLLBACK \u8a9e\u53e5\u4e2d\uff0c\u60a8\u53ef\u4ee5\u63a7\u5236\u4ea4\u6613\u908a\u754c\uff0c\u907f\u514d\u6df7\u5408\u6a21\u5f0f\u548c\u6578\u64da\u8a9e\u53e5\u3002<\/li>\n<p>\u793a\u4f8b\uff1a<\/p>\n<pre>\r\n  BEGIN;\r\n  -- \u8207\u6a21\u5f0f\u76f8\u95dc\u7684\u8a9e\u53e5\r\n  CREATE TABLE schema.table_name (column1 datatype, column2 datatype);\r\n  ALTER TABLE schema.table_name ADD COLUMN column3 datatype;\r\n  -- \u63d0\u4ea4\u6a21\u5f0f\u66f4\u6539\r\n  COMMIT;\r\n\r\n  BEGIN;\r\n  -- \u8207\u6578\u64da\u76f8\u95dc\u7684\u8a9e\u53e5\r\n  INSERT INTO schema.table_name (column1, column2) VALUES (value1, value2);\r\n  UPDATE schema.table_name SET column3 = value3 WHERE condition;\r\n  -- \u63d0\u4ea4\u6578\u64da\u66f4\u6539\r\n  COMMIT;\r\n  <\/pre>\n<li><strong>\u4f7f\u7528\u81e8\u6642\u8868\uff1a<\/strong>\u5982\u679c\u60a8\u9700\u8981\u5728\u540c\u4e00\u4ea4\u6613\u4e2d\u57f7\u884c\u6a21\u5f0f\u548c\u6578\u64da\u64cd\u4f5c\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u81e8\u6642\u8868\u3002\u81e8\u6642\u8868\u5728\u6703\u8a71\u4e2d\u5275\u5efa\uff0c\u4e26\u5728\u6703\u8a71\u7d50\u675f\u6642\u81ea\u52d5\u522a\u9664\u3002\u901a\u904e\u4f7f\u7528\u81e8\u6642\u8868\uff0c\u60a8\u53ef\u4ee5\u5728\u540c\u4e00\u4ea4\u6613\u4e2d\u5206\u958b\u6a21\u5f0f\u548c\u6578\u64da\u8a9e\u53e5\u3002<\/li>\n<p>\u793a\u4f8b\uff1a<\/p>\n<pre>\r\n  BEGIN;\r\n  -- \u8207\u6a21\u5f0f\u76f8\u95dc\u7684\u8a9e\u53e5\r\n  CREATE TEMPORARY TABLE temp_table_name (column1 datatype, column2 datatype);\r\n  ALTER TABLE temp_table_name ADD COLUMN column3 datatype;\r\n  -- \u8207\u6578\u64da\u76f8\u95dc\u7684\u8a9e\u53e5\r\n  INSERT INTO temp_table_name (column1, column2) VALUES (value1, value2);\r\n  UPDATE temp_table_name SET column3 = value3 WHERE condition;\r\n  -- \u63d0\u4ea4\u66f4\u6539\r\n  COMMIT;\r\n  <\/pre>\n<\/ol>\n<p>\u901a\u904e\u9075\u5faa\u9019\u4e9b\u89e3\u6c7a\u65b9\u6848\uff0c\u60a8\u53ef\u4ee5\u89e3\u6c7a PostgreSQL \u932f\u8aa4\u4ee3\u78bc\uff1a25007 &#8211; schema_and_data_statement_mixing_not_supported\uff0c\u4e26\u78ba\u4fdd\u6578\u64da\u5eab\u64cd\u4f5c\u7684\u6b63\u78ba\u57f7\u884c\u3002<\/p>\n<h2>\u7e3d\u7d50<\/h2>\n<p>\u7e3d\u4e4b\uff0cPostgreSQL \u932f\u8aa4\u4ee3\u78bc\uff1a25007 &#8211; schema_and_data_statement_mixing_not_supported \u767c\u751f\u5728\u5617\u8a66\u5728\u540c\u4e00\u4ea4\u6613\u4e2d\u6df7\u5408\u6a21\u5f0f\u548c\u6578\u64da\u8a9e\u53e5\u6642\u3002\u8981\u4fee\u5fa9\u6b64\u932f\u8aa4\uff0c\u60a8\u53ef\u4ee5\u5c07\u6a21\u5f0f\u548c\u6578\u64da\u8a9e\u53e5\u5206\u958b\u5230\u4e0d\u540c\u7684\u4ea4\u6613\u4e2d\uff0c\u4f7f\u7528\u986f\u5f0f\u4ea4\u6613\uff0c\u6216\u4f7f\u7528\u81e8\u6642\u8868\u3002\u901a\u904e\u5be6\u65bd\u9019\u4e9b\u89e3\u6c7a\u65b9\u6848\uff0c\u60a8\u53ef\u4ee5\u78ba\u4fdd PostgreSQL \u6578\u64da\u5eab\u7684\u5b8c\u6574\u6027\u548c\u53ef\u9760\u6027\u3002<\/p>\n<p>\u6709\u95dc VPS \u8a17\u7ba1\u53ca\u5176\u5982\u4f55\u4f7f\u60a8\u7684\u696d\u52d9\u53d7\u76ca\u7684\u66f4\u591a\u4fe1\u606f\uff0c\u8acb\u8a2a\u554f <a href=\"https:\/\/server.hk\">Server.HK<\/a>\u3002\u6211\u5011\u7684\u9999\u6e2f VPS \u8a17\u7ba1\u89e3\u6c7a\u65b9\u6848\u4e00\u6d41\uff0c\u70ba\u60a8\u7684\u61c9\u7528\u63d0\u4f9b\u53ef\u9760\u7684\u6027\u80fd\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-21358","post","type-post","status-publish","format-standard","hentry","category-4925"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/21358","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=21358"}],"version-history":[{"count":2,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/21358\/revisions"}],"predecessor-version":[{"id":24140,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/21358\/revisions\/24140"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=21358"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=21358"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=21358"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}