ALTER_TEXT_SEARCH_CONFIGURATION(7pg13)

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

πŸ’… ALTER TEXT SEARCH CONFIGURATION (7pg13) β€” the glow-up edition ✨

okay bestie, so this is the page for ALTER_TEXT_SEARCH_CONFIGURATION from the PostgreSQL 13.23 Documentation, and it's basically the "let me change my whole text-search vibe" command. get comfy 🫢


✨ NAME ✨

ALTER_TEXT_SEARCH_CONFIGURATION β€” change the definition of a text search configuration πŸŽ€

like, you can reshuffle it, rename it, hand it off to someone else… the whole makeover. πŸ’…


🌸 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_USER | SESSION_USER }
ALTER TEXT SEARCH CONFIGURATION name SET SCHEMA new_schema

copy these exactly, bestie, they're not vibes you can freestyle 😭


πŸ¦‹ DESCRIPTION πŸ¦‹

ALTER TEXT SEARCH CONFIGURATION changes the definition of a text search configuration. lowkey iconic? you can modify its mappings from token types to dictionaries, or change the configuration's name or owner. it's giving full rebrand. ✨

⚠️ okay important: you must be the owner of the configuration to use ALTER TEXT SEARCH CONFIGURATION. no owner energy, no makeover. periodt.

πŸ’œ PARAMETERS πŸ’œ

  • name β€” the name (optionally schema-qualified) of an existing text search configuration. like, the one you're about to glam up.
  • token_type β€” the name of a token type that is emitted by the configuration's parser. the parser hands it to you, you don't invent it 🧚
  • 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 one stepping into the spotlight πŸ‘‘
  • 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.

and now the actual behaviour tea, because this is the part that matters πŸ”₯:

  • 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. no duplicates allowed, it will literally yell at you πŸ’€
  • 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 = precise, no FOR = everywhere at once. choose wisely 🌈
  • 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. and it is an error if there is no mapping for the token types β€” unless IF EXISTS appears. IF EXISTS is your emotional support flag, fr fr 🫢

πŸŽ€ EXAMPLES πŸŽ€

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

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

see how there's no FOR? that's the "do it everywhere" mode. main character energy move. ⭐


⭐ COMPATIBILITY ⭐

there is no ALTER TEXT SEARCH CONFIGURATION statement in the SQL standard.

so… it's a PostgreSQL original, bestie. not a single standard to be found. πŸ’€βœ¨


🌈 SEE ALSO 🌈


okay that's the whole page, no notes πŸ‘‘

sign-off time: this little masterpiece is from PostgreSQL 13.23, dated 2025 β€” and the header/footer were giving ALTER TE...IGURATION(7) because terminal truncation is a hater 😭 go forth and remap your dictionaries, bestie πŸ’–πŸŒΈπŸ«Ά

πŸ“¦ where this page comes from