ALTER_TEXT_SEARCH_CONFIGURATION(7pg15)

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

πŸ’… ALTER_TEXT_SEARCH_CONFIGURATION πŸ’…

okay so bestie, this is the ALTER_TEXT_SEARCH_CONFIGURATION(7) page from the PostgreSQL 15 docs, and it's literally all about tweaking a text search configuration after you already made it. no cap. let's get into it 🫢


✨ NAME ✨

ALTER_TEXT_SEARCH_CONFIGURATION β€” change the definition of a text search configuration. iconic behavior honestly πŸŽ€


🌸 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

πŸ¦‹ DESCRIPTION πŸ¦‹

ALTER TEXT SEARCH CONFIGURATION changes the definition of a text search configuration. you get to mess with its mappings from token types to dictionaries, or you can change the configuration's name or its owner. so many options, main character energy fr πŸ’–

heads up bestie: you must be the owner of the configuration to use ALTER TEXT SEARCH CONFIGURATION. no owner, no slay. πŸ”‘

πŸ’œ PARAMETERS πŸ’œ

  • name β€” the name of an existing text search configuration (optionally schema-qualified). yes, with the schema and everything if you're feeling fancy ✨
  • token_type β€” the name of a token type that is emitted by the configuration's parser πŸ‘‘
  • 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 specified them. first come, first served, periodt πŸ“
  • old_dictionary β€” the name of a text search dictionary that's getting replaced in the mapping πŸ‘‹
  • new_dictionary β€” the name of a text search dictionary that's getting substituted in for old_dictionary. it's giving glow-up πŸ’…
  • new_name β€” the new name of the text search configuration 🏷️
  • new_owner β€” the new owner of the text search configuration πŸ‘‘
  • new_schema β€” the new schema for the text search configuration πŸ—‚οΈ

so here's the vibe check on each form, lowkey important:

  • 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, it will absolutely not let you do that, no cap 😭
  • the ALTER MAPPING FOR form does the same thing, but it first removes 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 happens only for the specified token types when FOR appears, and for all mappings of the configuration when it doesn't. 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. bye bye πŸ‘‹ it is an error if there's no mapping for the token types, unless IF EXISTS appears. then it's chill πŸ’€

🧚 EXAMPLES 🧚

the following example replaces the english dictionary with the swedish dictionary anywhere that english is used within my_config. obsessed honestly:

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. not a thing. we're simply built different, bestie πŸ™ˆ


⭐ SEE ALSO ⭐


and that's the whole page, bestie!! 🌸 this absolute icon of a doc is from PostgreSQL 15.19, dated 2026 β€” go forth and alter those text search configurations, you've got this πŸ’–πŸ«ΆπŸ”₯

πŸ“¦ where this page comes from