We're updating the issue view to help you get more done. 

IN parameter is not enclosed in parentheses

Description

We have a query with the following parts:

1 2 3 LEFT JOIN (reservation_detail rd INNER JOIN reservation r ON (r.id = rd.reservation_id AND r.status NOT IN :cancelled )) ... WHERE hrt.hotel_id IN :hotelIds AND ...

The second one that doesn't have any parentheses is generated properly

1 WHERE hrt.hotel_id IN (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,...)

But the first part becomes

1 LEFT JOIN (reservation_detail rd INNER JOIN reservation r ON (r.id = rd.reservation_id AND r.status NOT IN ?, ?, ? ))

Currently the workaround is to add the parentheses, so I'm submitting this as minor priority, but it's my understanding that the JPA implementation is supposed to add them.

Note that this is in a Named Native Query. It might work in JPQL queries, but we don't use them, because it's much harder to develop and test them in pgAdmin

Environment

None

Status

Assignee

Gail Badner

Reporter

Йордан Гигов

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Affects versions

5.0.6
5.0.5

Priority

Minor