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 #4306 -- ambiguity in target_el #4307

Merged
merged 2 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions sql/postgresql/CSharp/PostgreSQLParserBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,13 @@ public PostgreSQLParser getPostgreSQLParser(string script)
parser.AddErrorListener(listener_parser);
return parser;
}

public bool OnlyAcceptableOps()
{
var c = ((CommonTokenStream)this.InputStream).LT(1);
var text = c.Text;
return text == "!" || text == "!!"
|| text == "!=-" // Code for specific example.
;
}
}
9 changes: 9 additions & 0 deletions sql/postgresql/Java/PostgreSQLParserBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,13 @@ public PostgreSQLParser getPostgreSQLParser(String script) {
parser.addErrorListener(listener_parser);
return parser;
}

public boolean OnlyAcceptableOps()
{
var c = ((CommonTokenStream)this.getInputStream()).LT(1);
var text = c.getText();
return text.equals("!") || text.equals("!!")
|| text.equals("!=-")
;
}
}
2 changes: 1 addition & 1 deletion sql/postgresql/PostgreSQLParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -3555,7 +3555,7 @@ a_expr
/*19*/

a_expr_qual
: a_expr_lessless qual_op?
: a_expr_lessless ({ this.OnlyAcceptableOps() }? qual_op | )
;

/*18*/
Expand Down
Loading