ALTER_FOREIGN_DATA_WRAPPER(7pg17)
π ALTER_FOREIGN_DATA_WRAPPER π
okay bestie, so this is a page straight out of the PostgreSQL 17.11 Documentation, and it's all about ALTER_FOREIGN_DATA_WRAPPER β the glow-up command for your foreign-data wrappers β¨
πΈ 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_ROLE | CURRENT_USER | SESSION_USER }
ALTER FOREIGN DATA WRAPPER name RENAME TO new_name
π DESCRIPTION π
So ALTER FOREIGN DATA_WRAPPER literally just changes the definition of a foreign-data wrapper. that's the whole vibe π
The first form of the command changes the support functions or the generic options of the foreign-data wrapper β and no cap, at least one clause is required or it's not doing anything for you π«Ά
The second form changes the owner of the foreign-data wrapper, main character energy π
β οΈ okay important: only superusers can alter foreign-data wrappers. and additionally, only superusers can own foreign-data wrappers. not me gatekeeping but fr fr π
π PARAMETERS π
nameβ the name of an existing foreign-data wrapper. yep, it has to already exist bestie π¦HANDLER handler_functionβ gives the foreign-data wrapper a brand new handler function β¨NO HANDLERβ says the foreign-data wrapper should no longer have a handler function, bye π
π¨ note that foreign tables that use a foreign-data wrapper with no handler cannot be accessed. like, at all. dead π
VALIDATOR validator_functionβ sets a shiny new validator function for the foreign-data wrapper π
π note that it's 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. and PostgreSQL does not check for this. it's up to you to make sure those options are correct before using the modified foreign-data wrapper, iykyk. However, any options specified in this ALTER FOREIGN DATA WRAPPER command will be checked using the new validator π«Ά
NO VALIDATORβ says the foreign-data wrapper should no longer have a validator function. iconic, no notes πOPTIONS ( [ ADD | SET | DROP ] option ['value'] [, ... ] )β change options for the foreign-data wrapper.ADD,SET, andDROPspecify the action to be performed, andADDis assumed if no operation is explicitly specified. also 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. rebrand era π¦
π₯ 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. special little extras, periodt β¨
π SEE ALSO π
CREATE FOREIGN DATA WRAPPER(CREATE_FOREIGN_DATA_WRAPPER(7))DROP FOREIGN DATA WRAPPER(DROP_FOREIGN_DATA_WRAPPER(7))
and that's the tea bestie π this whole thing is from PostgreSQL 17.11, dated 2026, filed under ALTER FOR...A WRAPPER(7) β slay, go alter some wrappers, ily ππ§ββοΈ
π¦ where this page comes from
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-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