ALTER_TEXT_SEARCH_CONFIGURATION(7pg17)
π 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 forold_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 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. so don't try to double-add, it will not slay. π - the
ALTER MAPPING FORform 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 REPLACEforms substitutenew_dictionaryforold_dictionaryanywhere the latter appears. whenFORappears, this happens only for the specified token types; whenFORdoesn't appear, it happens for all mappings of the configuration. 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. it is an error if there is no mapping for the token types, unlessIF EXISTSappears. 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 π
CREATE TEXT SEARCH CONFIGURATION(CREATE_TEXT_SEARCH_CONFIGURATION(7))DROP TEXT SEARCH CONFIGURATION(DROP_TEXT_SEARCH_CONFIGURATION(7))
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
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-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