Skip to content

SQL Parsing Error #1439

@Devharajan-Rangarajan

Description

@Devharajan-Rangarajan

There is an issue with the parsing of the native SQL Queries for both the .id options and the Group by clause

image

Sample Code for Quick Copy:

@query(
value =
"""
SELECT v.name AS vendor_name,
COUNT(m.id) AS mould_count
FROM moulds m
LEFT JOIN vendor v ON v.id = m.converter_id
WHERE AND m.mould_code_lifecycle_stage != 'RETIRED'
AND m.mould_type = 'PRODUCTION'
AND m.id IN (SELECT unnest(allowed_moulds::bigint[])
FROM user_allowed_items
WHERE user_id = :userId)
GROUP BY v.name
ORDER BY mould_count DESC
LIMIT 5
""",
nativeQuery = true)
List<Object[]> getTopConverter(@param("userId") Long userId);

Errors Thrown:

  1. PostgreSQL: no viable alternative at input '(m' [SQL_SYNTAX]
  2. PostgreSQL: no viable alternative at input 'GROUP' [SQL_SYNTAX]

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions