Fix query parsing error for properties using reserved lateral keyword.

Add tests for existing parsers and fix the HQL one.

Closes #3496
Original pull request #3497
This commit is contained in:
Christoph Strobl
2024-06-05 09:05:16 +02:00
committed by Jens Schauder
parent 17990f2d44
commit 0024985016
4 changed files with 22 additions and 0 deletions

View File

@@ -768,6 +768,7 @@ reservedWord
| JOIN
| KEY
| LAST
| LATERAL
| LEADING
| LEFT
| LIKE

View File

@@ -1024,4 +1024,11 @@ class EqlQueryRendererTests {
String source = "select new com.company.%s.thing.stuff.ClassName(e.id) from Experience e".formatted(reservedWord);
assertQuery(source);
}
@Test // GH-3496
void lateralShouldBeAValidParameter() {
assertQuery("select e from Employee e where e.lateral = :_lateral");
assertQuery("select te from TestEntity te where te.lateral = :lateral");
}
}

View File

@@ -1566,6 +1566,13 @@ class HqlQueryRendererTests {
assertQuery("select te from TestEntity te where te.type = :type");
}
@Test // GH-3496
void lateralShouldBeAValidParameter() {
assertQuery("select e from Employee e where e.lateral = :_lateral");
assertQuery("select te from TestEntity te where te.lateral = :lateral");
}
@Test // GH-3099
void functionNamesShouldSupportSchemaScoping() {

View File

@@ -963,6 +963,13 @@ class JpqlQueryRendererTests {
assertQuery("select te from TestEntity te where te.type = :type");
}
@Test // GH-3496
void lateralShouldBeAValidParameter() {
assertQuery("select e from Employee e where e.lateral = :_lateral");
assertQuery("select te from TestEntity te where te.lateral = :lateral");
}
@Test // GH-3061
void alternateNotEqualsOperatorShouldWork() {
assertQuery("select e from Employee e where e.firstName != :name");