Skip to content

Commit

Permalink
[postgresql] Fix for #4306 -- ambiguity in target_el (#4307)
Browse files Browse the repository at this point in the history
* Fix for #4306

* Workaround for the '!=-' operator.
  • Loading branch information
kaby76 authored Nov 4, 2024
1 parent eace15f commit 688537b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
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 @@ -3545,7 +3545,7 @@ a_expr
/*19*/

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

/*18*/
Expand Down

0 comments on commit 688537b

Please sign in to comment.