ALTER_TEXT_SEARCH_CONFIGURATION(7pg17)

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

πŸ’… ALTER_TEXT_SEARCH_CONFIGURATION β€” bestie edition

okay so this is a 7pg17 manual page, and it's all about ALTER TEXT SEARCH CONFIGURATION, which honestly sounds intimidating but is literally just "hey, let me tweak my text search config real quick." You've got this. 🫢


✨ NAME ✨

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


🌸 SYNOPSIS 🌸

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

seven whole forms, all iconic, all doing their own little thing ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

ALTER TEXT SEARCH CONFIGURATION changes the definition of a text search configuration. Basically you can remix the mappings from token types to dictionaries, or you can change the configuration's name or owner. Glow-up on any of those fronts, your choice. πŸ‘‘

important: you must be the owner of the configuration to use ALTER TEXT SEARCH CONFIGURATION. no ownership, no editing. it's giving exclusive club. πŸ™ˆ

πŸ’… PARAMETERS πŸ’…

  • name β€” the name of an existing text search configuration, and yeah it can be schema-qualified if you're feeling fancy. πŸ’«
  • token_type β€” the name of a token type that is emitted by the configuration's parser. it's what the parser spits out, lowkey.
  • dictionary_name β€” the name of a text search dictionary to be consulted for the specified token type(s). if you list multiple dictionaries, they get consulted in the order you listed them, so order matters, bestie. 🌈
  • old_dictionary β€” the name of a text search dictionary to be replaced in the mapping. it's literally the one getting swapped out. 😭
  • new_dictionary β€” the name of a text search dictionary to be substituted for old_dictionary. the replacement, the understudy, the main character stepping in. ⭐
  • new_name β€” the new name of the text search configuration. rebrand era. πŸŽ€
  • new_owner β€” the new owner of the text search configuration.
  • new_schema β€” the new schema for the text search configuration.

now let's break down how the forms actually behave, because this part matters and i want you to get it fr fr:

  • 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. so don't try to double-add, it will not slay. πŸ’€
  • the ALTER MAPPING FOR form does the same thing, but first removes any existing mapping for those token types. so it's the add but it clears space first, very "out with the old." ✨
  • the ALTER MAPPING REPLACE forms substitute new_dictionary for old_dictionary anywhere the latter appears. when FOR appears, this happens only for the specified token types; when FOR doesn't appear, it happens for all mappings of the configuration. iykyk. πŸ”₯
  • the DROP MAPPING form removes all dictionaries for the specified token type(s), which causes tokens of those types to be ignored by the text search configuration. it is an error if there is no mapping for the token types, unless IF EXISTS appears. so like, know your mappings before you start dropping things. πŸ™ˆ

πŸ“ EXAMPLES πŸ“

okay so the classic demo: this one replaces the english dictionary with the swedish dictionary anywhere that english is used within my_config. no cap, that's the whole thing:

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. so if a standards purist comes for you, that's the tea. β˜•


πŸ’œ SEE ALSO πŸ’œ

go make your config, then come back here to remix it, then drop it if you must. full lifecycle, bestie. πŸ¦‹


cute little sign-off: this page is from PostgreSQL 17.11, dated 2026. mwah πŸ’‹ β€” go forth and alter responsibly. πŸ’…βœ¨
πŸ“¦ where this page comes from