ALTER_FOREIGN_DATA_WRAPPER(7pg15)

πŸ“¦ version 15.19, in opensuse-leap 16.0

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 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. bye-bye validation era. πŸ™ˆ
  • OPTIONS ( [ ADD | SET | DROP ] option ['value'] [, ... ] ) β€” change options for the foreign-data wrapper. ADD, SET, and DROP specify the action to be performed. ADD 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. πŸ’…
  • 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 πŸ’œ

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