Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[postgresql] Fix for #4308, #4315 -- ambiguity and plpgsql grammar. #4316

Merged
merged 6 commits into from
Nov 10, 2024

Conversation

kaby76
Copy link
Contributor

@kaby76 kaby76 commented Nov 9, 2024

This PR fixes #4308 and #4315. The issue was caused by adding in rules for PL/PGSQL into PostgreSQL. These rules were added to parse function bodies, but the changes also affected parsing of PostgreSQL. The problem is that the lexing rules overlap between the two languages. You cannot simply add two non-disjoint lexer rules together because you then have an enormous task in trying to clarify the PostgreSQL parser rules, least of which is the ambiguity. This is probably why there's a collection of tests that fail in the examples.errors/ directory.

The ambiguity no longer exists. trparse --ambig -i "SELECT 'trailing' AS first;" | trtree -a yields no ambiguity trees.

The plan is to re-add parsing of function bodies with a completely separate grammar for pl/pgsql later.

@kaby76 kaby76 changed the title [postgresql] Fix for #4308, #4315 -- ambiguity and plpgsql grammar issues. [postgresql] Fix for #4308, #4315 -- ambiguity and plpgsql grammar. Nov 9, 2024
@kaby76 kaby76 marked this pull request as ready for review November 9, 2024 18:30
@teverett
Copy link
Member

@kaby76 thanks

@teverett teverett merged commit ffa52fd into antlr:master Nov 10, 2024
10 checks passed
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.

[postgresql] collabel is ambiguous; postgresql contains some plsql rules.
2 participants