PostgreSQL: add support for CREATE TEXT SEARCH CONFIGURATION/DICTIONARY/PARSER/TEMPLATE#2315
Open
fmguerreiro wants to merge 6 commits intoapache:mainfrom
Open
PostgreSQL: add support for CREATE TEXT SEARCH CONFIGURATION/DICTIONARY/PARSER/TEMPLATE#2315fmguerreiro wants to merge 6 commits intoapache:mainfrom
fmguerreiro wants to merge 6 commits intoapache:mainfrom
Conversation
- Collapse the four near-identical parse arms in parse_create_text_search; parse the subtype keyword once, then parse name and options once, then map the subtype to the Statement variant. - Spanned impls now return the name's span instead of Span::empty(), matching sibling Create* statements. - Doc comments on each `options: Vec<SqlOption>` no longer claim the parser enforces required keys; they note PostgreSQL's requirements and clarify that enforcement is left to the engine. - Add a test exercising schema-qualified option values (e.g. PARSER = pg_catalog.default) to guard the round-trip.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds PostgreSQL grammar for the four
CREATE TEXT SEARCHvariants:CREATE TEXT SEARCH CONFIGURATION name (PARSER = parser_name)CREATE TEXT SEARCH DICTIONARY name (TEMPLATE = template_name, ...)CREATE TEXT SEARCH PARSER name (START = fn, GETTOKEN = fn, END = fn, LEXTYPES = fn[, HEADLINE = fn])CREATE TEXT SEARCH TEMPLATE name (LEXIZE = fn[, INIT = fn])Reference: https://www.postgresql.org/docs/current/textsearch-dictionaries.html
Changes
src/ast/ddl.rs(CreateTextSearchConfiguration,CreateTextSearchDictionary,CreateTextSearchParser,CreateTextSearchTemplate) withfmt::Display+From<T> for Statement.Statementvariants and re-exports.Spannedarms usingSpan::empty().parse_create_text_searchdispatcher insrc/parser/mod.rs.tests/sqlparser_postgres.rscovering each variant plus optional-clause combinations.Out of scope
ALTER TEXT SEARCHvariants. Scope kept small for reviewability.Notes
Originally shipped via the
pgmold-sqlparserfork; tested against PostgreSQL 13–17 schemas in pgmold.