ALTER_TEXT_SEARCH_DICTIONARY(7pg15)

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

✨ 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 like myschema.mydict is 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 = something is 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 🫢

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