{"Entry":{"collection":"sql","key":"alter-foreign-data-wrapper","name":"ALTER FOREIGN DATA WRAPPER","aliases":["alterforeigndatawrapper"],"metadata":{"aliases":["alterforeigndatawrapper"],"changed_in":["9.1","9.2","9.5","14","19"],"changes":[{"from":"8.3","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":[],"removed":[]},"status":"added","synopsis":null,"to":"8.4"},{"from":"9.0","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["description","parameters","compatibility"],"removed":[]},"status":"changed","synopsis":{"added":["[ HANDLER handler_function | NO HANDLER ]","[ VALIDATOR validator_function | NO VALIDATOR ]"],"removed":["[ VALIDATOR valfunction | NO VALIDATOR ]"]},"to":"9.1"},{"from":"9.1","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["parameters","compatibility"],"removed":[]},"status":"changed","synopsis":{"added":["ALTER FOREIGN DATA WRAPPER name RENAME TO new_name"],"removed":[]},"to":"9.2"},{"from":"9.2","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["parameters"],"removed":[]},"status":"changed","synopsis":null,"to":"9.3"},{"from":"9.4","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":[],"removed":[]},"status":"changed","synopsis":{"added":["ALTER FOREIGN DATA WRAPPER name OWNER TO { new_owner | CURRENT_USER | SESSION_USER }"],"removed":[]},"to":"9.5"},{"from":"11","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["examples"],"removed":[]},"status":"changed","synopsis":null,"to":"12"},{"from":"13","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":[],"removed":[]},"status":"changed","synopsis":{"added":["ALTER FOREIGN DATA WRAPPER name OWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }"],"removed":[]},"to":"14"},{"from":"18","purpose_changed":false,"renamed":null,"sections":{"added":[],"changed":["parameters"],"removed":[]},"status":"changed","synopsis":{"added":["[ VALIDATOR validator_function | NO VALIDATOR ]","[ CONNECTION connection_function | NO CONNECTION ]"],"removed":[]},"to":"19"}],"content_hash":"e8e6e9104b5ba6c0cdc196c400451c6e01178f80b7e7d1eff4886c722c98b279","derived_content_hash":"e4bd0358840d491299636b27b81f5161413ddb3ca9a8b51e792e429e7c881706","editorial":{},"first_version":"8.4","group":"foreign","imported_at":"2026-09-30T17:43:38.697737+08:00","last_version":"20","name":"ALTER FOREIGN DATA WRAPPER","object":"FOREIGN DATA WRAPPER","position":9001,"present_in":["8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6","10","11","12","13","14","15","16","17","18","19","20"],"purpose":"change the definition of a foreign-data wrapper","purpose_zh":"","related":["create-foreign-data-wrapper","drop-foreign-data-wrapper"],"repair_provenance":{"original_source_revision":"wiki-repair-20261023:a6b0f685cf7d24086c093b42c9bafdaef1b5dccd4520f98251fb1a5c00d0bed6","receipt_sha256":"46eecd51791b0778aa6b6018ec97f91b92981eed25f5c535e03609cd6ee8929c","repair":"wiki-repair-20261023"},"slug":"alter-foreign-data-wrapper","source_rev":"wiki-repair-20261023:58c72044c83888f58e77a7c3a1f0d6a8d81261c04f6508cff3038da6ae4c9102","synopsis":"ALTER FOREIGN DATA WRAPPER name\n[ HANDLER handler_function | NO HANDLER ]\n[ VALIDATOR validator_function | NO VALIDATOR ]\n[ CONNECTION connection_function | NO CONNECTION ]\n[ OPTIONS ( [ ADD | SET | DROP ] option ['value'] [, ... ]) ]\nALTER FOREIGN DATA WRAPPER name OWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\nALTER FOREIGN DATA WRAPPER name RENAME TO new_name","verb":"ALTER"}},"Definition":{"Collection":"sql","Key":"alter-foreign-data-wrapper","SourceDatabase":"center","Version":"18","SourceTable":"sqlcmd","SourceKey":"alter-foreign-data-wrapper","SourceRevision":"wiki-repair-20261023:58c72044c83888f58e77a7c3a1f0d6a8d81261c04f6508cff3038da6ae4c9102","Facts":{"anchor":"SQL-ALTERFOREIGNDATAWRAPPER","description_zh":"更改外部数据包装器的定义","description_zh_html":"\u003cpre\u003eALTER FOREIGN DATA WRAPPER name\n[ HANDLER handler_function | NO HANDLER ]\n[ VALIDATOR validator_function | NO VALIDATOR ]\n[ OPTIONS ( [ ADD | SET | DROP ] option [\u0026#x27;value\u0026#x27;] [, ... ]) ]\nALTER FOREIGN DATA WRAPPER name OWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\nALTER FOREIGN DATA WRAPPER name RENAME TO new_name\u003c/pre\u003e\u003csection\u003e\u003ch2\u003e描述\u003c/h2\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003eALTER FOREIGN DATA WRAPPER\u003c/code\u003e 更改外部数据包装器的定义。该命令的第一种形式更改外部数据包装器的支持函数或通用选项（至少需要一个子句）。第二种形式更改外部数据包装器的拥有者。\n  \u003c/p\u003e\u003cp\u003e\n   只有超级用户可以更改外部数据包装器。此外，只有超级用户才能成为外部数据包装器的拥有者。\n  \u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e参数\u003c/h2\u003e\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt id=\"ZH18-AUTO-ALTER_FOREIGN_DATA_WRAPPER-VARLISTENTRY-1\"\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      一个现有外部数据包装器的名称。\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-ALTER_FOREIGN_DATA_WRAPPER-VARLISTENTRY-2\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eHANDLER \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehandler_function\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      为外部数据包装器指定一个新的处理器函数。\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-ALTER_FOREIGN_DATA_WRAPPER-VARLISTENTRY-3\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eNO HANDLER\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      用于指定该外部数据包装器不再具有一个处理器函数。\n     \u003c/p\u003e\u003cp\u003e\n      注意，使用没有处理器函数的外部数据包装器的外部表将无法访问。\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-ALTER_FOREIGN_DATA_WRAPPER-VARLISTENTRY-4\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eVALIDATOR \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalidator_function\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      为外部数据包装器指定一个新的验证器函数。\n     \u003c/p\u003e\u003cp\u003e\n      注意，该外部数据包装器本身或者依赖它的服务器、用户映射或外部表中预先存在的选项，根据新的验证器可能是无效的。\u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e\n      不会检查这一点。用户必须在使用修改后的外部数据包装器之前自行确保这些选项正确。不过，在此 \u003ccode class=\"command\"\u003eALTER FOREIGN DATA\n      WRAPPER\u003c/code\u003e 命令中指定的任何选项，都会使用新的验证器进行检查。\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-ALTER_FOREIGN_DATA_WRAPPER-VARLISTENTRY-5\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eNO VALIDATOR\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      用于指定该外部数据包装器不再具有验证器函数。\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-ALTER_FOREIGN_DATA_WRAPPER-VARLISTENTRY-6\"\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eOPTIONS ( [ ADD | SET | DROP ] \u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e ['\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e'] [, ... ] )\u003c/code\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      更改外部数据包装器的选项。\u003ccode class=\"literal\"\u003eADD\u003c/code\u003e、\u003ccode class=\"literal\"\u003eSET\u003c/code\u003e\n      和 \u003ccode class=\"literal\"\u003eDROP\u003c/code\u003e 指定要执行的动作。如果未显式指定操作，则假定为 \u003ccode class=\"literal\"\u003eADD\u003c/code\u003e。选项名称必须唯一；如果存在验证器函数，选项名称和值也会使用该外部数据包装器的验证器函数进行验证。\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-ALTER_FOREIGN_DATA_WRAPPER-VARLISTENTRY-7\"\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_owner\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      该外部数据包装器的新拥有者的用户名。\n     \u003c/p\u003e\u003c/dd\u003e\u003cdt id=\"ZH18-AUTO-ALTER_FOREIGN_DATA_WRAPPER-VARLISTENTRY-8\"\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_name\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e \u003c/dt\u003e\u003cdd\u003e\u003cp\u003e\n      该外部数据包装器的新名称。\n     \u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e示例\u003c/h2\u003e\u003cp\u003e\n   更改外部数据包装器 \u003ccode class=\"literal\"\u003edbi\u003c/code\u003e，添加选项 \u003ccode class=\"literal\"\u003efoo\u003c/code\u003e，删除 \u003ccode class=\"literal\"\u003ebar\u003c/code\u003e：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\nALTER FOREIGN DATA WRAPPER dbi OPTIONS (ADD foo '1', DROP bar);\n\u003c/pre\u003e\u003cp\u003e\n\u003c/p\u003e\u003cp\u003e\n   将外部数据包装器 \u003ccode class=\"literal\"\u003edbi\u003c/code\u003e 的验证器更改为\n   \u003ccode class=\"literal\"\u003ebob.myvalidator\u003c/code\u003e：\n\u003c/p\u003e\u003cpre class=\"programlisting\"\u003e\nALTER FOREIGN DATA WRAPPER dbi VALIDATOR bob.myvalidator;\n\u003c/pre\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e兼容性\u003c/h2\u003e\u003cp\u003e\n\u003ccode class=\"command\"\u003eALTER FOREIGN DATA WRAPPER\u003c/code\u003e 符合 ISO/IEC\n   9075-9 (SQL/MED)，但 \u003ccode class=\"literal\"\u003eHANDLER\u003c/code\u003e、\u003ccode class=\"literal\"\u003eVALIDATOR\u003c/code\u003e、\u003ccode class=\"literal\"\u003eOWNER TO\u003c/code\u003e 和\n   \u003ccode class=\"literal\"\u003eRENAME\u003c/code\u003e 子句属于扩展。\n  \u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003e另见\u003c/h2\u003e\u003cspan class=\"simplelist\"\u003e\u003ca class=\"xref\" href=\"/zh/docs/18/sql-createforeigndatawrapper.html\" title=\"CREATE FOREIGN DATA WRAPPER\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE FOREIGN DATA WRAPPER\u003c/span\u003e\u003c/a\u003e, \u003ca class=\"xref\" href=\"/zh/docs/18/sql-dropforeigndatawrapper.html\" title=\"DROP FOREIGN DATA WRAPPER\"\u003e\u003cspan class=\"refentrytitle\"\u003eDROP FOREIGN DATA WRAPPER\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\u003c/section\u003e","file":"sql-alterforeigndatawrapper.html","lang":"en","name":"ALTER FOREIGN DATA WRAPPER","purpose":"change the definition of a foreign-data wrapper","purpose_zh":"更改外部数据包装器的定义","related":["create-foreign-data-wrapper","drop-foreign-data-wrapper"],"sections":[{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eALTER FOREIGN DATA WRAPPER\u003c/code\u003e changes the definition of a foreign-data wrapper. The first form of the command changes the support functions or the generic options of the foreign-data wrapper (at least one clause is required). The second form changes the owner of the foreign-data wrapper.\u003c/p\u003e\u003cp\u003eOnly superusers can alter foreign-data wrappers. Additionally, only superusers can own foreign-data wrappers.\u003c/p\u003e","key":"description","title":"Description"},{"html":"\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe name of an existing foreign-data wrapper.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eHANDLER \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehandler_function\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eSpecifies a new handler function for the foreign-data wrapper.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eNO HANDLER\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThis is used to specify that the foreign-data wrapper should no longer have a handler function.\u003c/p\u003e\u003cp\u003eNote that foreign tables that use a foreign-data wrapper with no handler cannot be accessed.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eVALIDATOR \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalidator_function\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eSpecifies a new validator function for the foreign-data wrapper.\u003c/p\u003e\u003cp\u003eNote that it is possible that pre-existing options of the foreign-data wrapper, or of dependent servers, user mappings, or foreign tables, are invalid according to the new validator. \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e does not check for this. It is up to the user to make sure that these options are correct before using the modified foreign-data wrapper. However, any options specified in this \u003ccode class=\"command\"\u003eALTER FOREIGN DATA WRAPPER\u003c/code\u003e command will be checked using the new validator.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eNO VALIDATOR\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThis is used to specify that the foreign-data wrapper should no longer have a validator function.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eOPTIONS ( [ ADD | SET | DROP ] \u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e ['\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e'] [, ... ] )\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eChange options for the foreign-data wrapper. \u003ccode class=\"literal\"\u003eADD\u003c/code\u003e, \u003ccode class=\"literal\"\u003eSET\u003c/code\u003e, and \u003ccode class=\"literal\"\u003eDROP\u003c/code\u003e specify the action to be performed. \u003ccode class=\"literal\"\u003eADD\u003c/code\u003e is assumed if no operation is explicitly specified. Option names must be unique; names and values are also validated using the foreign data wrapper's validator function, if any.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_owner\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe user name of the new owner of the foreign-data wrapper.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_name\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe new name for the foreign-data wrapper.\u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e","key":"parameters","title":"Parameters"},{"html":"\u003cp\u003eChange a foreign-data wrapper \u003ccode class=\"literal\"\u003edbi\u003c/code\u003e, add option \u003ccode class=\"literal\"\u003efoo\u003c/code\u003e, drop \u003ccode class=\"literal\"\u003ebar\u003c/code\u003e:\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eALTER FOREIGN DATA WRAPPER dbi OPTIONS (ADD foo '1', DROP bar);\n\u003c/pre\u003e\u003cp\u003eChange the foreign-data wrapper \u003ccode class=\"literal\"\u003edbi\u003c/code\u003e validator to \u003ccode class=\"literal\"\u003ebob.myvalidator\u003c/code\u003e:\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eALTER FOREIGN DATA WRAPPER dbi VALIDATOR bob.myvalidator;\n\u003c/pre\u003e","key":"examples","title":"Examples"},{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eALTER FOREIGN DATA WRAPPER\u003c/code\u003e conforms to ISO/IEC 9075-9 (SQL/MED), except that the \u003ccode class=\"literal\"\u003eHANDLER\u003c/code\u003e, \u003ccode class=\"literal\"\u003eVALIDATOR\u003c/code\u003e, \u003ccode class=\"literal\"\u003eOWNER TO\u003c/code\u003e, and \u003ccode class=\"literal\"\u003eRENAME\u003c/code\u003e clauses are extensions.\u003c/p\u003e","key":"compatibility","title":"Compatibility"},{"html":"\u003cspan class=\"simplelist\"\u003e\u003ca href=\"/wiki/sql/create-foreign-data-wrapper/?v=18\" title=\"CREATE FOREIGN DATA WRAPPER\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE FOREIGN DATA WRAPPER\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/drop-foreign-data-wrapper/?v=18\" title=\"DROP FOREIGN DATA WRAPPER\"\u003e\u003cspan class=\"refentrytitle\"\u003eDROP FOREIGN DATA WRAPPER\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e","key":"see_also","title":"See Also"}],"sections_same_as":"","slug":"18","synopsis_html":"ALTER FOREIGN DATA WRAPPER \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\n    [ HANDLER \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehandler_function\u003c/code\u003e\u003c/em\u003e | NO HANDLER ]\n    [ VALIDATOR \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalidator_function\u003c/code\u003e\u003c/em\u003e | NO VALIDATOR ]\n    [ OPTIONS ( [ ADD | SET | DROP ] \u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e ['\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e'] [, ... ]) ]\nALTER FOREIGN DATA WRAPPER \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e OWNER TO { \u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_owner\u003c/code\u003e\u003c/em\u003e | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\nALTER FOREIGN DATA WRAPPER \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e RENAME TO \u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_name\u003c/code\u003e\u003c/em\u003e","synopsis_text":"ALTER FOREIGN DATA WRAPPER name\n[ HANDLER handler_function | NO HANDLER ]\n[ VALIDATOR validator_function | NO VALIDATOR ]\n[ OPTIONS ( [ ADD | SET | DROP ] option ['value'] [, ... ]) ]\nALTER FOREIGN DATA WRAPPER name OWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\nALTER FOREIGN DATA WRAPPER name RENAME TO new_name","translation_provenance":{"inputs":[{"kind":"current-pgdoc-translation","path":"/Users/vonng/pgsty/pgdoc/zh/18/html/sql-alterforeigndatawrapper.html","sha256":"ac2935a5499918e12f2c6665feaf406782a23b0e7de66dc1cdb5d440c2924a2d"}],"kind":"same-version-pgdoc","locale":"zh-Hans","source_revision":"b1b500221dbe5437cfca004d6b04d3f6e422765d","version":"18"},"zh_from":"same-version-pgdoc"},"ManualEvidence":{},"MeasuredEvidence":{}},"Text":{"Collection":"sql","Key":"alter-foreign-data-wrapper","SourceDatabase":"center","Version":"18","Locale":"en","Title":"ALTER FOREIGN DATA WRAPPER","Summary":"change the definition of a foreign-data wrapper","BodyHTML":"\u003cpre\u003eALTER FOREIGN DATA WRAPPER name\n[ HANDLER handler_function | NO HANDLER ]\n[ VALIDATOR validator_function | NO VALIDATOR ]\n[ OPTIONS ( [ ADD | SET | DROP ] option [\u0026#39;value\u0026#39;] [, ... ]) ]\nALTER FOREIGN DATA WRAPPER name OWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\nALTER FOREIGN DATA WRAPPER name RENAME TO new_name\u003c/pre\u003e\u003csection\u003e\u003ch2\u003eDescription\u003c/h2\u003e\u003cp\u003e\u003ccode\u003eALTER FOREIGN DATA WRAPPER\u003c/code\u003e changes the definition of a foreign-data wrapper. The first form of the command changes the support functions or the generic options of the foreign-data wrapper (at least one clause is required). The second form changes the owner of the foreign-data wrapper.\u003c/p\u003e\u003cp\u003eOnly superusers can alter foreign-data wrappers. Additionally, only superusers can own foreign-data wrappers.\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eParameters\u003c/h2\u003e\u003cdiv\u003e\u003cdl\u003e\u003cdt\u003e\u003cspan\u003e\u003cem\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe name of an existing foreign-data wrapper.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003eHANDLER \u003cem\u003e\u003ccode\u003ehandler_function\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eSpecifies a new handler function for the foreign-data wrapper.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003eNO HANDLER\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThis is used to specify that the foreign-data wrapper should no longer have a handler function.\u003c/p\u003e\u003cp\u003eNote that foreign tables that use a foreign-data wrapper with no handler cannot be accessed.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003eVALIDATOR \u003cem\u003e\u003ccode\u003evalidator_function\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eSpecifies a new validator function for the foreign-data wrapper.\u003c/p\u003e\u003cp\u003eNote that it is possible that pre-existing options of the foreign-data wrapper, or of dependent servers, user mappings, or foreign tables, are invalid according to the new validator. \u003cspan\u003ePostgreSQL\u003c/span\u003e does not check for this. It is up to the user to make sure that these options are correct before using the modified foreign-data wrapper. However, any options specified in this \u003ccode\u003eALTER FOREIGN DATA WRAPPER\u003c/code\u003e command will be checked using the new validator.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003eNO VALIDATOR\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThis is used to specify that the foreign-data wrapper should no longer have a validator function.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003ccode\u003eOPTIONS ( [ ADD | SET | DROP ] \u003cem\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e [\u0026#39;\u003cem\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e\u0026#39;] [, ... ] )\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eChange options for the foreign-data wrapper. \u003ccode\u003eADD\u003c/code\u003e, \u003ccode\u003eSET\u003c/code\u003e, and \u003ccode\u003eDROP\u003c/code\u003e specify the action to be performed. \u003ccode\u003eADD\u003c/code\u003e is assumed if no operation is explicitly specified. Option names must be unique; names and values are also validated using the foreign data wrapper\u0026#39;s validator function, if any.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003cem\u003e\u003ccode\u003enew_owner\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe user name of the new owner of the foreign-data wrapper.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan\u003e\u003cem\u003e\u003ccode\u003enew_name\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe new name for the foreign-data wrapper.\u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eExamples\u003c/h2\u003e\u003cp\u003eChange a foreign-data wrapper \u003ccode\u003edbi\u003c/code\u003e, add option \u003ccode\u003efoo\u003c/code\u003e, drop \u003ccode\u003ebar\u003c/code\u003e:\u003c/p\u003e\u003cpre\u003eALTER FOREIGN DATA WRAPPER dbi OPTIONS (ADD foo \u0026#39;1\u0026#39;, DROP bar);\n\u003c/pre\u003e\u003cp\u003eChange the foreign-data wrapper \u003ccode\u003edbi\u003c/code\u003e validator to \u003ccode\u003ebob.myvalidator\u003c/code\u003e:\u003c/p\u003e\u003cpre\u003eALTER FOREIGN DATA WRAPPER dbi VALIDATOR bob.myvalidator;\n\u003c/pre\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eCompatibility\u003c/h2\u003e\u003cp\u003e\u003ccode\u003eALTER FOREIGN DATA WRAPPER\u003c/code\u003e conforms to ISO/IEC 9075-9 (SQL/MED), except that the \u003ccode\u003eHANDLER\u003c/code\u003e, \u003ccode\u003eVALIDATOR\u003c/code\u003e, \u003ccode\u003eOWNER TO\u003c/code\u003e, and \u003ccode\u003eRENAME\u003c/code\u003e clauses are extensions.\u003c/p\u003e\u003c/section\u003e\u003csection\u003e\u003ch2\u003eSee Also\u003c/h2\u003e\u003cspan\u003e\u003ca href=\"/wiki/sql/create-foreign-data-wrapper/?v=18\" title=\"CREATE FOREIGN DATA WRAPPER\" rel=\"nofollow\"\u003e\u003cspan\u003eCREATE FOREIGN DATA WRAPPER\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/drop-foreign-data-wrapper/?v=18\" title=\"DROP FOREIGN DATA WRAPPER\" rel=\"nofollow\"\u003e\u003cspan\u003eDROP FOREIGN DATA WRAPPER\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e\u003c/section\u003e","SourceRevision":"wiki-repair-20261023:58c72044c83888f58e77a7c3a1f0d6a8d81261c04f6508cff3038da6ae4c9102","ContentHash":"b1a682e16f2947d73e8fbb15c4eaa58dd5bfd90a00fc5cfc7594b0a76e310ae2","Payload":{"related":["create-foreign-data-wrapper","drop-foreign-data-wrapper"],"sections":[{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eALTER FOREIGN DATA WRAPPER\u003c/code\u003e changes the definition of a foreign-data wrapper. The first form of the command changes the support functions or the generic options of the foreign-data wrapper (at least one clause is required). The second form changes the owner of the foreign-data wrapper.\u003c/p\u003e\u003cp\u003eOnly superusers can alter foreign-data wrappers. Additionally, only superusers can own foreign-data wrappers.\u003c/p\u003e","key":"description","title":"Description"},{"html":"\u003cdiv class=\"variablelist\"\u003e\u003cdl class=\"variablelist\"\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe name of an existing foreign-data wrapper.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eHANDLER \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehandler_function\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eSpecifies a new handler function for the foreign-data wrapper.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eNO HANDLER\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThis is used to specify that the foreign-data wrapper should no longer have a handler function.\u003c/p\u003e\u003cp\u003eNote that foreign tables that use a foreign-data wrapper with no handler cannot be accessed.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eVALIDATOR \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalidator_function\u003c/code\u003e\u003c/em\u003e\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eSpecifies a new validator function for the foreign-data wrapper.\u003c/p\u003e\u003cp\u003eNote that it is possible that pre-existing options of the foreign-data wrapper, or of dependent servers, user mappings, or foreign tables, are invalid according to the new validator. \u003cspan class=\"productname\"\u003ePostgreSQL\u003c/span\u003e does not check for this. It is up to the user to make sure that these options are correct before using the modified foreign-data wrapper. However, any options specified in this \u003ccode class=\"command\"\u003eALTER FOREIGN DATA WRAPPER\u003c/code\u003e command will be checked using the new validator.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eNO VALIDATOR\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThis is used to specify that the foreign-data wrapper should no longer have a validator function.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003ccode class=\"literal\"\u003eOPTIONS ( [ ADD | SET | DROP ] \u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e ['\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e'] [, ... ] )\u003c/code\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eChange options for the foreign-data wrapper. \u003ccode class=\"literal\"\u003eADD\u003c/code\u003e, \u003ccode class=\"literal\"\u003eSET\u003c/code\u003e, and \u003ccode class=\"literal\"\u003eDROP\u003c/code\u003e specify the action to be performed. \u003ccode class=\"literal\"\u003eADD\u003c/code\u003e is assumed if no operation is explicitly specified. Option names must be unique; names and values are also validated using the foreign data wrapper's validator function, if any.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_owner\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe user name of the new owner of the foreign-data wrapper.\u003c/p\u003e\u003c/dd\u003e\u003cdt\u003e\u003cspan class=\"term\"\u003e\u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_name\u003c/code\u003e\u003c/em\u003e\u003c/span\u003e\u003c/dt\u003e\u003cdd\u003e\u003cp\u003eThe new name for the foreign-data wrapper.\u003c/p\u003e\u003c/dd\u003e\u003c/dl\u003e\u003c/div\u003e","key":"parameters","title":"Parameters"},{"html":"\u003cp\u003eChange a foreign-data wrapper \u003ccode class=\"literal\"\u003edbi\u003c/code\u003e, add option \u003ccode class=\"literal\"\u003efoo\u003c/code\u003e, drop \u003ccode class=\"literal\"\u003ebar\u003c/code\u003e:\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eALTER FOREIGN DATA WRAPPER dbi OPTIONS (ADD foo '1', DROP bar);\n\u003c/pre\u003e\u003cp\u003eChange the foreign-data wrapper \u003ccode class=\"literal\"\u003edbi\u003c/code\u003e validator to \u003ccode class=\"literal\"\u003ebob.myvalidator\u003c/code\u003e:\u003c/p\u003e\u003cpre class=\"programlisting\"\u003eALTER FOREIGN DATA WRAPPER dbi VALIDATOR bob.myvalidator;\n\u003c/pre\u003e","key":"examples","title":"Examples"},{"html":"\u003cp\u003e\u003ccode class=\"command\"\u003eALTER FOREIGN DATA WRAPPER\u003c/code\u003e conforms to ISO/IEC 9075-9 (SQL/MED), except that the \u003ccode class=\"literal\"\u003eHANDLER\u003c/code\u003e, \u003ccode class=\"literal\"\u003eVALIDATOR\u003c/code\u003e, \u003ccode class=\"literal\"\u003eOWNER TO\u003c/code\u003e, and \u003ccode class=\"literal\"\u003eRENAME\u003c/code\u003e clauses are extensions.\u003c/p\u003e","key":"compatibility","title":"Compatibility"},{"html":"\u003cspan class=\"simplelist\"\u003e\u003ca href=\"/wiki/sql/create-foreign-data-wrapper/?v=18\" title=\"CREATE FOREIGN DATA WRAPPER\"\u003e\u003cspan class=\"refentrytitle\"\u003eCREATE FOREIGN DATA WRAPPER\u003c/span\u003e\u003c/a\u003e, \u003ca href=\"/wiki/sql/drop-foreign-data-wrapper/?v=18\" title=\"DROP FOREIGN DATA WRAPPER\"\u003e\u003cspan class=\"refentrytitle\"\u003eDROP FOREIGN DATA WRAPPER\u003c/span\u003e\u003c/a\u003e\u003c/span\u003e","key":"see_also","title":"See Also"}],"sections_same_as":"","synopsis_html":"ALTER FOREIGN DATA WRAPPER \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e\n    [ HANDLER \u003cem class=\"replaceable\"\u003e\u003ccode\u003ehandler_function\u003c/code\u003e\u003c/em\u003e | NO HANDLER ]\n    [ VALIDATOR \u003cem class=\"replaceable\"\u003e\u003ccode\u003evalidator_function\u003c/code\u003e\u003c/em\u003e | NO VALIDATOR ]\n    [ OPTIONS ( [ ADD | SET | DROP ] \u003cem class=\"replaceable\"\u003e\u003ccode\u003eoption\u003c/code\u003e\u003c/em\u003e ['\u003cem class=\"replaceable\"\u003e\u003ccode\u003evalue\u003c/code\u003e\u003c/em\u003e'] [, ... ]) ]\nALTER FOREIGN DATA WRAPPER \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e OWNER TO { \u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_owner\u003c/code\u003e\u003c/em\u003e | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\nALTER FOREIGN DATA WRAPPER \u003cem class=\"replaceable\"\u003e\u003ccode\u003ename\u003c/code\u003e\u003c/em\u003e RENAME TO \u003cem class=\"replaceable\"\u003e\u003ccode\u003enew_name\u003c/code\u003e\u003c/em\u003e","synopsis_text":"ALTER FOREIGN DATA WRAPPER name\n[ HANDLER handler_function | NO HANDLER ]\n[ VALIDATOR validator_function | NO VALIDATOR ]\n[ OPTIONS ( [ ADD | SET | DROP ] option ['value'] [, ... ]) ]\nALTER FOREIGN DATA WRAPPER name OWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }\nALTER FOREIGN DATA WRAPPER name RENAME TO new_name"}},"RequestedLocale":"en","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","8.4","9.0","9.1","9.2","9.3","9.4","9.5","9.6"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
