ALTER_TEXT_SEARCH_DICTIONARY(7pg15)
β¨ ALTER_TEXT_SEARCH_DICTIONARY β¨
okay bestie, so you know how text search dictionaries are like, a whole thing in PostgreSQL? this page is literally all about poking at one after it's already been made π . it's giving "glow-up for your dictionary" energy, and ngl it's iconic.
it lives in the PostgreSQL 15.19 docs, so like, that's the vibe we're on β¨.
π NAME π
ALTER_TEXT_SEARCH_DICTIONARY β change the definition of a text search dictionary
like, you're literally editing a dictionary that already exists. main character energy fr fr π«Ά
πΈ SYNOPSIS πΈ
ALTER TEXT SEARCH DICTIONARY name (
option [ = value ] [, ... ]
)
ALTER TEXT SEARCH DICTIONARY name RENAME TO new_name
ALTER TEXT SEARCH DICTIONARY name OWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
ALTER TEXT SEARCH DICTIONARY name SET SCHEMA new_schema
four whole ways to do it, pick your fighter οΏ½οΏ½ββοΈβ¨
π¦ DESCRIPTION π¦
okay so ALTER TEXT SEARCH DICTIONARY changes the definition of a text search dictionary. that's the whole assignment π
. you can change the dictionary's template-specific options, or change the dictionary's name or owner. multiple paths, all valid, no cap π₯
β οΈ and like, important: you must be the owner of the dictionary to use ALTER TEXT SEARCH DICTIONARY. not your friend's cousin, not the group chat β you. periodt π
π PARAMETERS π
nameβ the name of an existing text search dictionary. it can optionally be schema-qualified (iykyk), so likemyschema.mydictis totally a valid vibe.optionβ the name of a template-specific option to be set for this dictionary. think of it as, like, a specific setting that only your dictionary's template understands π§valueβ the new value to use for a template-specific option. and here's the cute part: if the equal sign and value are omitted, then any previous setting for the option is removed from the dictionary, letting the default be used. so( StopWords )with no= somethingis literally you saying "forget this setting, go back to default bestie" πβ¨new_nameβ the new name of the text search dictionary. rebranding era πnew_ownerβ the new owner of the text search dictionary. handing over the keys πnew_schemaβ the new schema for the text search dictionary. moving houses π
π‘ little note: template-specific options can appear in any order. no pressure to alphabetize, bestie, it's not that deep π
β EXAMPLES β
changing the stopword list
the following example command changes the stopword list for a Snowball-based dictionary. other parameters remain unchanged. slay, minimal effort, maximum result π
ALTER TEXT SEARCH DICTIONARY my_dict ( StopWords = newrussian );
changing language and nuking stopwords
the following example command changes the language option to dutch, and removes the stopword option entirely. two birds, one statement π¦
ALTER TEXT SEARCH DICTIONARY my_dict ( language = dutch, StopWords );
the iconic "dummy" trick
the following example command "updates" the dictionary's definition without actually changing anything. yes bestie, it's giving doing-nothing-but-make-it-look-like-something π
ALTER TEXT SEARCH DICTIONARY my_dict ( dummy );
okay so why does this even work?? (the reason this works is that the option removal code doesn't complain if there is no such option.) wild, i know π
π and here's the tea: this trick is useful when changing configuration files for the dictionary β the ALTER will force existing database sessions to re-read the configuration files, which otherwise they would never do if they had read them earlier. so it's basically a "hey wake up and re-read your notes" nudge to every session. no cap, lowkey genius π₯
π COMPATIBILITY π
there is no ALTER TEXT SEARCH DICTIONARY statement in the SQL standard.
so like... it's a PostgreSQL-only vibe. the standard said no, Postgres said bet β¨π
π«Ά SEE ALSO π«Ά
CREATE TEXT SEARCH DICTIONARY(CREATE_TEXT_SEARCH_DICTIONARY(7))DROP TEXT SEARCH DICTIONARY(DROP_TEXT_SEARCH_DICTIONARY(7))
make it, then change it, then (sadly) drop it. the whole life cycle bestie ππ¦
okay that's the whole page! sourced straight from the PostgreSQL 15.19 documentation, dated 2026, and formatted with love (and a lot of emoji) for you π«Άπ go forth and alter your dictionaries, you absolute icon πβ¨
π¦ 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