CREATE_TEXT_SEARCH_PARSER(7pg16)

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

πŸ’… CREATE_TEXT_SEARCH_PARSER

okay bestie, welcome to the CREATE TEXT SEARCH PARSER page β€” that's the Postgres 16.15 docs, and yes this is the glow-up version ✨


🌸 NAME

CREATE_TEXT_SEARCH_PARSER β€” define a new text search parser πŸŽ€


✨ SYNOPSIS

CREATE TEXT SEARCH PARSER name (
    START = start_function ,
    GETTOKEN = gettoken_function ,
    END = end_function ,
    LEXTYPES = lextypes_function
    [, HEADLINE = headline_function ]
)

πŸ¦‹ DESCRIPTION

So CREATE TEXT SEARCH PARSER literally creates a brand-new text search parser. And what even is a parser? It's the thing that defines a method for splitting a text string into tokens and assigning types (categories) to those tokens. periodt πŸ’…

But here's the tea: a parser is not particularly useful by itself. It has to be bound into a text search configuration alongside some text search dictionaries before it's actually usable for searching. iykyk.

If a schema name is given, then the text search parser gets created in that specified schema. Otherwise it's created in the current schema. simple as that 🫢

⚠️ You must be a superuser to use CREATE TEXT SEARCH PARSER. And no, that restriction isn't just for vibes β€” it's there because an erroneous text search parser definition could confuse or even crash the server. πŸ’€ so like, respect the gatekeeping.

Refer to Chapter 12 for further information πŸ“–


πŸŽ€ PARAMETERS

  • name β€” the name of the text search parser you're creating. It can be schema-qualified, no cap.
  • start_function β€” the name of the start function for the parser.
  • gettoken_function β€” the name of the get-next-token function for the parser.
  • end_function β€” the name of the end function for the parser.
  • lextypes_function β€” the name of the lextypes function for the parser (it's the function that returns info about the set of token types it produces).
  • headline_function β€” the name of the headline function for the parser (a function that summarizes a set of tokens).

The function names can be schema-qualified if necessary. Argument types are not given, since the argument list for each type of function is predetermined β€” iconic, honestly ✨

All except the headline function are required. πŸ‘‘

And plot twist: the arguments can appear in any order, not only the one shown above. main character energy for real.


🌈 COMPATIBILITY

There is no CREATE TEXT SEARCH PARSER statement in the SQL standard. πŸ™ˆ Postgres is just doing its own thing here, and we love that for it.


πŸ’œ SEE ALSO


and that's the whole page bestie, you ate that πŸ“πŸ’–

⭐ PostgreSQL 16.15 Β· 2026 ⭐ β€” that's the source and date, mwah, go forth and parse πŸŒΈπŸ‘‘

πŸ“¦ where this page comes from