ALTER_FOREIGN_DATA_WRAPPER(7pg13)
π ALTER_FOREIGN_DATA_WRAPPER(7pg13) π
okay bestie, this is the ALTER_FOREIGN_DATA_WRAPPER(7pg13) page from the PostgreSQL 13.23 docs. Buckle up, we're changing foreign-data wrapper definitions and being iconic about it. π¦
β¨ NAME β¨
ALTER_FOREIGN_DATA_WRAPPER β change the definition of a foreign-data wrapper
π SYNOPSIS π
ALTER FOREIGN DATA WRAPPER name
[ HANDLER handler_function | NO HANDLER ]
[ VALIDATOR validator_function | NO VALIDATOR ]
[ OPTIONS ( [ ADD | SET | DROP ] option ['value'] [, ... ]) ]
ALTER FOREIGN DATA WRAPPER name OWNER TO { new_owner | CURRENT_USER | SESSION_USER }
ALTER FOREIGN DATA WRAPPER name RENAME TO new_name
πΈ DESCRIPTION πΈ
ALTER FOREIGN DATA WRAPPER 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 β and yes, at least one clause is required. The second form changes the owner of the foreign-data wrapper.
Only superusers can alter foreign-data wrappers. Additionally, only superusers can own foreign-data wrappers. that's the rule, no cap. π
π¦ PARAMETERS π¦
nameβ the name of an existing foreign-data wrapper. got it? good. πHANDLER handler_functionβ specifies a new handler function for the foreign-data wrapper. slay, new handler. β¨NO HANDLERβ used to specify that the foreign-data wrapper should no longer have a handler function.
bestie, warning: foreign tables that use a foreign-data wrapper with no handler cannot be accessed. like, at all. π
VALIDATOR validator_functionβ specifies a new validator function for the foreign-data wrapper.
okay so this is the messy part: 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. PostgreSQL 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 ALTER FOREIGN DATA WRAPPER command will be checked using the new validator. π
NO VALIDATORβ used to specify that the foreign-data wrapper should no longer have a validator function.OPTIONS ( [ ADD | SET | DROP ] option ['value'] [, ... ] )β change options for the foreign-data wrapper.ADD,SET, andDROPspecify the action to be performed.ADDis 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. πnew_ownerβ the user name of the new owner of the foreign-data wrapper.new_nameβ the new name for the foreign-data wrapper.
π§ EXAMPLES π§
Change a foreign-data wrapper dbi, add option foo, drop bar:
ALTER FOREIGN DATA WRAPPER dbi OPTIONS (ADD foo '1', DROP bar);
Change the foreign-data wrapper dbi validator to bob.myvalidator:
ALTER FOREIGN DATA WRAPPER dbi VALIDATOR bob.myvalidator;
π COMPATIBILITY π
ALTER FOREIGN DATA WRAPPER conforms to ISO/IEC 9075-9 (SQL/MED), except that the HANDLER, VALIDATOR, OWNER TO, and RENAME clauses are extensions. iykyk. β¨
π SEE ALSO π
CREATE FOREIGN DATA WRAPPER(CREATE_FOREIGN_DATA_WRAPPER(7))DROP FOREIGN DATA WRAPPER(DROP_FOREIGN_DATA_WRAPPER(7))
kisses and sparkles, bestie: PostgreSQL 13.23 π, dated 2025 β¨ β and the footer gremlin says ALTER FOR...A WRAPPER(7). periodt. π«Ά
π¦ where this page comes from
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms