PostgreSQL gets very confused when date_part() is used in a GROUP BY and the part bit isn't a constant. It doesn't recognize the selected values as being identical to the grouped-by values, and throws an error. So we use a literal here.
This commit is contained in:
@@ -87,8 +87,8 @@ public class PostgreSQLBuilder
|
||||
|
||||
@Override public Void visit (DatePart exp)
|
||||
{
|
||||
return appendFunctionCall(
|
||||
"date_part", Exps.value(translateDatePart(exp.getPart())), exp.getArg());
|
||||
String datePart = "'" + translateDatePart(exp.getPart()) + "'";
|
||||
return appendFunctionCall("date_part", Exps.literal(datePart), exp.getArg());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user