-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Describe the bug
In PostgreSQL, year is treated as a reserved keyword, while in MySQL it is used as a function name.
When writing SQL in the PostgreSQL style such as extract(year from column_name), the FROM inside the parameter is incorrectly recognized as a clause, which introduces unwanted line breaks.
Additionally, when this function is used inside a conditional loop directive, the indentation of the function increases unexpectedly.
Example (current behavior):
SELECT
/*%if groupByDepartment */
d.department_name
,
/*%end*/
/*%if groupByLocation */
d.location
,
/*%end*/
/*%if groupByYear */
extract
(YEAR
FROM e.hire_date
, x) AS hire_year
,
/*%end*/ COUNT(*) AS employee_count
, AVG(s.salary_amount) AS avg_salaryExpected behavior
For cases like extract(year from column_name), the parameters should be formatted inline, without introducing unintended line breaks.
Desktop :
- IDEA Version : 2024.3.6
- Doma Tools Version : 2.1.1
Additional context
he excessive indentation is not limited to the year from parameter. It can also occur with other parameter specifications when conditional loop directives are used alongside preceding column blocks.