ALTER_TEXT_SEARCH_DICTIONARY(7pg14)

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

πŸ’… ALTER TEXT SEARCH DICTIONARY

okay so bestie, welcome to ALTER TEXT SEARCH DICTIONARY β€” that's page 7 of the PostgreSQL 14.24 Documentation, and yes we are reading the docs together, this is our bonding time 🫢


✨ NAME ✨

ALTER_TEXT_SEARCH_DICTIONARY β€” the glow-up command for a text search dictionary. It changes the definition of a text search dictionary. Iconic.


πŸŽ€ 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

like, four whole vibes, pick your fighter πŸ’…


🌸 DESCRIPTION 🌸

So ALTER TEXT SEARCH DICTIONARY changes the definition of a text search dictionary. You can change the dictionary's template-specific options, or change the dictionary's name or owner. Three levers, all yours πŸ”₯

⚠️ real talk: you must be the owner of the dictionary to use ALTER TEXT SEARCH DICTIONARY. no ownership, no entry. no cap.

πŸ¦‹ PARAMETERS πŸ¦‹

  • name β€” the name of an existing text search dictionary (optionally schema-qualified, bc we keep it flexible like that).
  • option β€” the name of a template-specific option to be set for this dictionary.
  • 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, allowing the default to be used. like a little reset button, lowkey 🫢
  • new_name β€” the new name of the text search dictionary.
  • new_owner β€” the new owner of the text search dictionary.
  • new_schema β€” the new schema for the text search dictionary.

Also, tiny detail that ate: Template-specific options can appear in any order. no rules, just right ✨


πŸ’– EXAMPLES πŸ’–

okay example time, this is the fun part πŸ“

The following example command changes the stopword list for a Snowball-based dictionary. Other parameters remain unchanged.

ALTER TEXT SEARCH DICTIONARY my_dict ( StopWords = newrussian );

The following example command changes the language option to dutch, and removes the stopword option entirely. not me multitasking πŸ’€

ALTER TEXT SEARCH DICTIONARY my_dict ( language = dutch, StopWords );

The following example command β€œupdates” the dictionary's definition without actually changing anything. the audacity, the confidence, the main character energy πŸ‘‘

ALTER TEXT SEARCH DICTIONARY my_dict ( dummy );

(and the reason this works is that the option removal code doesn't complain if there is no such option.) bestie this trick is genuinely 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. like, sessions are stubborn, we love a forced refresh 🌈


⭐ COMPATIBILITY ⭐

There is no ALTER TEXT SEARCH DICTIONARY statement in the SQL standard. so we're just out here being extra, standards who? πŸ™ˆ


πŸ‘‘ SEE ALSO πŸ‘‘

the holy trinity: make it, change it, drop it πŸ¦‹


and that's the page! brought to you by PostgreSQL 14.24, dated 2026 β€” tysm for reading the docs with me bestie, mwah πŸ’œπŸŽ€βœ¨

πŸ“¦ where this page comes from