CREATE_TEXT_SEARCH_PARSER(7pg16)
π 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
ALTER TEXT SEARCH PARSER(ALTER_TEXT_SEARCH_PARSER(7))DROP TEXT SEARCH PARSER(DROP_TEXT_SEARCH_PARSER(7))
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
- opensuse-leap 16.0: postgresql16 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16 16.15-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