ALTER_TEXT_SEARCH_CONFIGURATION(7pg15)
π 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 forold_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 FORform 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 FORform 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 REPLACEforms substitutenew_dictionaryforold_dictionaryanywhere the latter appears. this happens only for the specified token types whenFORappears, and for all mappings of the configuration when it doesn't. iykyk π - the
DROP MAPPINGform 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, unlessIF EXISTSappears. 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 β
CREATE TEXT SEARCH CONFIGURATION(CREATE_TEXT_SEARCH_CONFIGURATION(7))DROP TEXT SEARCH CONFIGURATION(DROP_TEXT_SEARCH_CONFIGURATION(7))
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
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms