{"id":20761,"date":"2024-01-02T05:30:22","date_gmt":"2024-01-02T05:30:22","guid":{"rendered":"https:\/\/server.hk\/blog\/20761\/"},"modified":"2024-11-14T10:39:10","modified_gmt":"2024-11-14T02:39:10","slug":"postgresql-command-drop-conversion","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/20761\/","title":{"rendered":"PostgreSQL \u547d\u4ee4\uff1aDROP CONVERSION"},"content":{"rendered":"<h1 id=\"postgresql-command-drop-conversion-pXrMpRFzDx\">PostgreSQL \u547d\u4ee4\uff1aDROP CONVERSION<\/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\u63d0\u4f9b\u5ee3\u6cdb\u7684\u529f\u80fd\u548c\u7279\u6027\u3002\u5728 PostgreSQL \u4e2d\uff0c\u4e00\u500b\u57fa\u672c\u547d\u4ee4\u662f DROP CONVERSION \u547d\u4ee4\uff0c\u8a72\u547d\u4ee4\u5141\u8a31\u7528\u6236\u5f9e\u6578\u64da\u5eab\u4e2d\u79fb\u9664\u4e00\u500b\u8f49\u63db\u3002<\/p>\n<h2 id=\"understanding-conversions-in-postgresql-pXrMpRFzDx\">\u7406\u89e3 PostgreSQL \u4e2d\u7684\u8f49\u63db<\/h2>\n<p>\u5728 PostgreSQL \u4e2d\uff0c\u8f49\u63db\u662f\u4e00\u7d44\u898f\u5247\uff0c\u7528\u4f86\u5b9a\u7fa9\u5982\u4f55\u5728\u4e0d\u540c\u5b57\u7b26\u7de8\u78bc\u4e4b\u9593\u9032\u884c\u6578\u64da\u8f49\u63db\u3002\u7576\u6578\u64da\u9700\u8981\u5f9e\u4e00\u7a2e\u7de8\u78bc\u8f49\u63db\u5230\u53e6\u4e00\u7a2e\u7de8\u78bc\u6642\uff0c\u4f8b\u5982\u5728\u5f9e\u5916\u90e8\u4f86\u6e90\u5c0e\u5165\u6578\u64da\u6216\u8655\u7406\u591a\u8a9e\u8a00\u6578\u64da\u5eab\u6642\uff0c\u5c31\u9700\u8981\u4f7f\u7528\u8f49\u63db\u3002<\/p>\n<p>\u8f49\u63db\u662f\u901a\u904e CREATE CONVERSION \u547d\u4ee4\u5275\u5efa\u7684\uff0c\u8a72\u547d\u4ee4\u6307\u5b9a\u6e90\u7de8\u78bc\u548c\u76ee\u6a19\u7de8\u78bc\uff0c\u4ee5\u53ca\u5c07\u8981\u4f7f\u7528\u7684\u8f49\u63db\u51fd\u6578\u3002\u4e00\u65e6\u5275\u5efa\u4e86\u8f49\u63db\uff0cPostgreSQL \u5c31\u53ef\u4ee5\u5728\u5fc5\u8981\u6642\u81ea\u52d5\u8f49\u63db\u6578\u64da\u3002<\/p>\n<h2 id=\"the-drop-conversion-command-pXrMpRFzDx\">DROP CONVERSION \u547d\u4ee4<\/h2>\n<p>DROP CONVERSION \u547d\u4ee4\u5141\u8a31\u7528\u6236\u5f9e\u6578\u64da\u5eab\u4e2d\u79fb\u9664\u4e00\u500b\u8f49\u63db\u3002\u8a72\u547d\u4ee4\u7684\u8a9e\u6cd5\u5982\u4e0b\uff1a<\/p>\n<pre><code>DROP CONVERSION [ IF EXISTS ] name [ CASCADE | RESTRICT ];\r\n<\/code><\/pre>\n<p><code>name<\/code> \u53c3\u6578\u6307\u5b9a\u8981\u522a\u9664\u7684\u8f49\u63db\u540d\u7a31\u3002\u53ef\u9078\u7684 <code>IF EXISTS<\/code> \u5b50\u53e5\u5141\u8a31\u8a72\u547d\u4ee4\u5373\u4f7f\u5728\u8f49\u63db\u4e0d\u5b58\u5728\u7684\u60c5\u6cc1\u4e0b\u4e5f\u80fd\u6210\u529f\u57f7\u884c\u3002<code>CASCADE<\/code> \u9078\u9805\u7528\u65bc\u81ea\u52d5\u522a\u9664\u4f9d\u8cf4\u65bc\u8a72\u8f49\u63db\u7684\u5c0d\u8c61\uff0c\u800c <code>RESTRICT<\/code> \u9078\u9805\u5247\u5728\u5b58\u5728\u4f9d\u8cf4\u5c0d\u8c61\u6642\u963b\u6b62\u8a72\u547d\u4ee4\u57f7\u884c\u3002<\/p>\n<p>\u91cd\u8981\u7684\u662f\u8981\u6ce8\u610f\uff0c\u53ea\u6709\u8d85\u7d1a\u7528\u6236\u548c\u8f49\u63db\u7684\u64c1\u6709\u8005\u624d\u80fd\u522a\u9664\u5b83\u3002<\/p>\n<h2 id=\"examples-pXrMpRFzDx\">\u7bc4\u4f8b<\/h2>\n<p>\u5047\u8a2d\u6211\u5011\u6709\u4e00\u500b\u540d\u70ba <code>utf8_to_latin1<\/code> \u7684\u8f49\u63db\uff0c\u7528\u65bc\u5c07\u6578\u64da\u5f9e UTF-8 \u7de8\u78bc\u8f49\u63db\u70ba Latin1 \u7de8\u78bc\u3002\u8981\u522a\u9664\u6b64\u8f49\u63db\uff0c\u6211\u5011\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre><code>DROP CONVERSION utf8_to_latin1;\r\n<\/code><\/pre>\n<p>\u5982\u679c\u6211\u5011\u53ea\u60f3\u5728\u8f49\u63db\u5b58\u5728\u7684\u60c5\u6cc1\u4e0b\u522a\u9664\u5b83\uff0c\u53ef\u4ee5\u5c07\u547d\u4ee4\u4fee\u6539\u70ba\uff1a<\/p>\n<pre><code>DROP CONVERSION IF EXISTS utf8_to_latin1;\r\n<\/code><\/pre>\n<p>\u5982\u679c\u8f49\u63db\u4e0a\u6709\u4f9d\u8cf4\u5c0d\u8c61\uff0c\u5982\u4f7f\u7528\u8a72\u8f49\u63db\u7684\u8868\u6216\u5217\uff0c\u6211\u5011\u53ef\u4ee5\u4f7f\u7528 <code>CASCADE<\/code> \u9078\u9805\uff0c\u81ea\u52d5\u4e00\u8d77\u522a\u9664\u5b83\u5011\uff1a<\/p>\n<pre><code>DROP CONVERSION utf8_to_latin1 CASCADE;\r\n<\/code><\/pre>\n<p>\u53e6\u4e00\u65b9\u9762\uff0c\u5982\u679c\u6211\u5011\u5e0c\u671b\u5728\u5b58\u5728\u4efb\u4f55\u4f9d\u8cf4\u5c0d\u8c61\u6642\u9632\u6b62\u8a72\u547d\u4ee4\u57f7\u884c\uff0c\u53ef\u4ee5\u4f7f\u7528 <code>RESTRICT<\/code> \u9078\u9805\uff1a<\/p>\n<pre><code>DROP CONVERSION utf8_to_latin1 RESTRICT;\r\n<\/code><\/pre>\n<h2 id=\"summary-pXrMpRFzDx\">\u7e3d\u7d50<\/h2>\n<p>PostgreSQL \u4e2d\u7684 DROP CONVERSION \u547d\u4ee4\u5141\u8a31\u7528\u6236\u5f9e\u6578\u64da\u5eab\u4e2d\u522a\u9664\u4e00\u500b\u8f49\u63db\u3002\u9019\u662f\u4e00\u500b\u7528\u65bc\u7ba1\u7406\u5b57\u7b26\u7de8\u78bc\u548c\u78ba\u4fdd\u6578\u64da\u4e00\u81f4\u6027\u7684\u5f37\u5927\u5de5\u5177\u3002\u901a\u904e\u6709\u6548\u5730\u7406\u89e3\u5982\u4f55\u4f7f\u7528\u9019\u500b\u547d\u4ee4\uff0c\u7528\u6236\u53ef\u4ee5\u7dad\u6301\u4e00\u500b\u7d44\u7e54\u826f\u597d\u4e14\u9ad8\u6548\u7684\u6578\u64da\u5eab\u74b0\u5883\u3002<\/p>\n<p>\u5982\u9700\u4e86\u89e3\u66f4\u591a\u95dc\u65bc VPS \u8a17\u7ba1\u548c PostgreSQL \u7684\u4fe1\u606f\uff0c\u8acb\u8a2a\u554f <a href=\"https:\/\/server.hk\">Server.HK<\/a>\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PostgreSQL \u547d\u4ee4\uff1aDR&#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-20761","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/20761","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=20761"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/20761\/revisions"}],"predecessor-version":[{"id":24351,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/20761\/revisions\/24351"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=20761"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=20761"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=20761"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}