-
Notifications
You must be signed in to change notification settings - Fork 0
Labels
Milestone
Description
Describe the bug
When a column name matches a PostgreSQL function name and is used immediately after a conditional loop directive, the formatter incorrectly introduces a line break in the condition.
Example (current behavior):
SELECT /*%expand*/
*
FROM employee
WHERE
/*%for age : ages */
age = /* age */30
/*%if age_has_next */
/*# "or" */
/*%end */
/*%end */
Problem
Here, because age matches the PostgreSQL function age(), it is incorrectly treated as a keyword block. As a result, the = operator is pushed to a new line.
Additionally, if the column name is enclosed in escape quotes, the indentation of the entire loop directive block is lost and unnecessary spaces are introduced:
SELECT /*%expand*/
*
FROM employee
WHERE
/*%for age : ages */
"age "= /* age */30
/*%if age_has_next */
/*# "or" */
/*%end */
/*%end */
Expected behavior
- Words that are not treated as functions in other databases should be handled as column names without introducing unwanted line breaks.
- When the element immediately following a conditional loop directive is enclosed in escape quotes, it should be indented properly without extra spaces.
Desktop :
- IDEA Version: 2024.3.6
- Doma Tools Version :2.1.2
Relational
#399