Skip to content

Commit bf28613

Browse files
committed
fix(/collection/{slug}): the query for categories statistic was failing on PostgreSQL.
The error was: org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [SELECT CASE WHEN 'ru' = ? THEN COALESCE(c.name_ru, c.name) ELSE c.name END AS name , SUM(s.quantity) AS counter FROM collections_series cs JOIN series s ON s.id = cs.series_id JOIN categories c ON c.id = s.category_id WHERE cs.collection_id = ? GROUP BY s.category_id]; nested exception is org.postgresql.util.PSQLException: ERROR: column "c.name_ru" must appear in the GROUP BY clause or be used in an aggregate function Thanks to Pavel Finkelshtein <[email protected]> for help to find a fix. Part of #1140
1 parent f3af559 commit bf28613

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/resources/sql/category_dao_queries.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ category.count_stamps_by_categories = \
6565
JOIN categories c \
6666
ON c.id = s.category_id \
6767
WHERE cs.collection_id = :collection_id \
68-
GROUP BY s.category_id
68+
GROUP BY c.id
6969

7070
category.find_ids_by_names = \
7171
SELECT c.id \

0 commit comments

Comments
 (0)