Skip to content

Commit f7a22f0

Browse files
committed
fix(/collection/{slug}): the query for countries statistic was failing on PostgreSQL.
The error was: org.springframework.jdbc.BadSqlGrammarException: PreparedStatementCallback; bad SQL grammar [SELECT COALESCE(CASE WHEN 'ru' = ? THEN COALESCE(c.name_ru, c.name) ELSE c.name END, 'Unknown') AS name , SUM(s.quantity) AS counter FROM collections_series cs JOIN series s ON s.id = cs.series_id LEFT JOIN countries c ON c.id = s.country_id WHERE cs.collection_id = ? GROUP BY s.country_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 Part of #1140
1 parent bf28613 commit f7a22f0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/resources/sql/country_dao_queries.properties

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

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

0 commit comments

Comments
 (0)