ALTER_TEXT_SEARCH_CONFIGURATION(7pg14)

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

πŸ’… ALTER TEXT SEARCH CONFIGURATION πŸ’…

okay so bestie, welcome to the PostgreSQL 14.24 Documentation glow-up of ALTER_TEXT_SEARCH_CONFIGURATION β€” this is the page where we mess with text search configurations, and honestly? it's giving main character energy πŸŽ€


✨ NAME ✨

ALTER_TEXT_SEARCH_CONFIGURATION β€” change the definition of a text search configuration. that's it, that's the whole vibe πŸ¦‹


✨ SYNOPSIS ✨

like, eight whole ways to do the thing. no cap, all of them matter:

ALTER TEXT SEARCH CONFIGURATION name
    ADD MAPPING FOR token_type [, ... ] WITH dictionary_name [, ... ]
ALTER TEXT SEARCH CONFIGURATION name
    ALTER MAPPING FOR token_type [, ... ] WITH dictionary_name [, ... ]
ALTER TEXT SEARCH CONFIGURATION name
    ALTER MAPPING REPLACE old_dictionary WITH new_dictionary
ALTER TEXT SEARCH CONFIGURATION name
    ALTER MAPPING FOR token_type [, ... ] REPLACE old_dictionary WITH new_dictionary
ALTER TEXT SEARCH CONFIGURATION name
    DROP MAPPING [ IF EXISTS ] FOR token_type [, ... ]
ALTER TEXT SEARCH CONFIGURATION name RENAME TO new_name
ALTER TEXT SEARCH CONFIGURATION name OWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
ALTER TEXT SEARCH CONFIGURATION name SET SCHEMA new_schema

✨ DESCRIPTION ✨

ALTER TEXT SEARCH CONFIGURATION changes the definition of a text search configuration. literally its whole job πŸ’– you can modify its mappings from token types to dictionaries, or change the configuration's name or owner. mix and match, go off.

🚨 vibe check, bestie: you must be the owner of the configuration to use ALTER TEXT SEARCH CONFIGURATION. not your business? not your edit. periodt.

🌸 PARAMETERS 🌸

  • name β€” the name (optionally schema-qualified) of an existing text search configuration. you know, the one you're about to alter πŸ’…
  • token_type β€” the name of a token type that is emitted by the configuration's parser. the parser's little output babies ✨
  • dictionary_name β€” the name of a text search dictionary to be consulted for the specified token type(s). if multiple dictionaries are listed, they are consulted in the specified order. order matters, iykyk 🫢
  • old_dictionary β€” the name of a text search dictionary to be replaced in the mapping. the one getting swapped out 😭
  • new_dictionary β€” the name of a text search dictionary to be substituted for old_dictionary. the glow-up replacement πŸ‘‘
  • new_name β€” the new name of the text search configuration. rebrand era 🌈
  • new_owner β€” the new owner of the text search configuration. passing the crown ⭐
  • new_schema β€” the new schema for the text search configuration. moving out, new address πŸ¦‹

okay now the part where it all actually makes sense β€” listen up:

the ADD MAPPING FOR form installs a list of dictionaries to be consulted for the specified token type(s); it is an error if there is already a mapping for any of the token types. like, no double-booking πŸ’€

the ALTER MAPPING FOR form does the same, but first removing any existing mapping for those token types. out with the old, in with the new πŸŽ€

the ALTER MAPPING REPLACE forms substitute new_dictionary for old_dictionary anywhere the latter appears. this is done for only the specified token types when FOR appears, or for all mappings of the configuration when it doesn't. so FOR = scoped, no FOR = everywhere, got it? πŸ’–

the DROP MAPPING form removes all dictionaries for the specified token type(s), causing tokens of those types to be ignored by the text search configuration. they're just… not invited anymore πŸ™ˆ it is an error if there is no mapping for the token types, unless IF EXISTS appears β€” then it's all chill ✨


πŸŽ€ EXAMPLES πŸŽ€

the following example replaces the english dictionary with the swedish dictionary anywhere that english is used within my_config. iconic swap, no notes πŸ’…

ALTER TEXT SEARCH CONFIGURATION my_config
  ALTER MAPPING REPLACE english WITH swedish;

πŸ”₯ COMPATIBILITY πŸ”₯

there is no ALTER TEXT SEARCH CONFIGURATION statement in the SQL standard. we're built different, bestie πŸ’€βœ¨


πŸ¦‹ SEE ALSO πŸ¦‹


and that's the whole page, bestie 🫢 go forth and remap your dictionaries. this has been PostgreSQL 14.24, dated 2026 β€” take care of yourselves and your token types πŸ’œπŸ§š

πŸ“¦ where this page comes from