ALTER_FOREIGN_DATA_WRAPPER(7pg15)
okay bestie, welcome to the ALTER FOREIGN DATA WRAPPER page (ALTER_FOREIGN_DATA_WRAPPER(7pg15)), straight outta the PostgreSQL 15.19 Documentation. this is the page about changing a foreign-data wrapperβs definition, and yes, the vibes are immaculate. π
β¨
π NAME π
ALTER_FOREIGN_DATA_WRAPPER β change the definition of a foreign-data wrapper. periodt. π
β¨ SYNOPSIS β¨
hereβs the group-chat shape of it, exact code, no cap:
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 π¦
ALTER FOREIGN DATA WRAPPER changes the definition of a foreign-data wrapper, lowkey iconic. The first form of the command changes the support functions or the generic options of the foreign-data wrapper β and bestie, 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 here, no exceptions listed. π
πΈ PARAMETERS πΈ
nameβ the name of an existing foreign-data wrapper. gotta exist already, iykyk. πHANDLER handler_functionβ specifies a new handler function for the foreign-data wrapper. new handler, who dis? π₯NO HANDLERβ used to specify that the foreign-data wrapper should no longer have a handler function. Note that foreign tables that use a foreign-data wrapper with no handler cannot be accessed. πVALIDATOR validator_functionβ specifies a new validator function for the foreign-data wrapper. Note 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. 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 thisALTER FOREIGN DATA WRAPPERcommand will be checked using the new validator. π«ΆNO VALIDATORβ used to specify that the foreign-data wrapper should no longer have a validator function. bye-bye validation era. π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. re-branding era, literally. β¨
π 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. so mostly ISO bestie, with a few extension sparkles. β¨
π SEE ALSO π
CREATE FOREIGN DATA WRAPPER(CREATE_FOREIGN_DATA_WRAPPER(7))DROP FOREIGN DATA WRAPPER(DROP_FOREIGN_DATA_WRAPPER(7))
go read those next, bestie. π
xoxo, your docs bestie π β signed off from the PostgreSQL 15.19 documentation, dated 2026, with the footer page label ALTER FOR...A WRAPPER(7). π
π¦ where this page comes from
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-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