Skip to content

Postgres: Support SUBSTRING SIMILAR/ESCAPE syntax and reversed FOR/FROM order - #2494

Open
BenSatori wants to merge 2 commits into
apache:mainfrom
BenSatori:postgres-substring-similar-escape
Open

Postgres: Support SUBSTRING SIMILAR/ESCAPE syntax and reversed FOR/FROM order#2494
BenSatori wants to merge 2 commits into
apache:mainfrom
BenSatori:postgres-substring-similar-escape

Conversation

@BenSatori

Copy link
Copy Markdown
Contributor

Fixes parsing of two legal Postgres SUBSTRING forms:

  • SUBSTRING('hello world' FOR 5 FROM 1) (FOR before FROM)
  • SUBSTRING('hello world' SIMILAR '%#"o w#"%' ESCAPE '#')

See https://www.postgresql.org/docs/current/functions-string.html

Both previously failed with a parser error. Adds a similar flag to Expr::Substring to track the SIMILAR ... ESCAPE display form, and allows FOR to be parsed before FROM (normalized to FROM ... FOR on output).

Generated with AI assistance (GitHub Copilot).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant