ALTER_TEXT_SEARCH_CONFIGURATION(7pg14)
π 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 forold_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 π¦
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 π«Ά 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
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-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