Postgres returns a timestamp from date_trunc, whereas MySQL returns a
date from date(). We should probably just modify DateFuncs.date to return a date in both cases (perhaps with a separate DateFun.DateCast class), but for now it's easier to have MySQL return a timestamp as well.
This commit is contained in:
@@ -90,7 +90,10 @@ public class MySQLBuilder
|
|||||||
public Void visit (DateTruncate exp)
|
public Void visit (DateTruncate exp)
|
||||||
{
|
{
|
||||||
// exp.getTruncation() is currently always DAY
|
// exp.getTruncation() is currently always DAY
|
||||||
return appendFunctionCall("date", exp.getArg());
|
_builder.append(" cast(");
|
||||||
|
appendFunctionCall("date", exp.getArg());
|
||||||
|
_builder.append(" as datetime)");
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getDateFunction (Part part)
|
protected String getDateFunction (Part part)
|
||||||
|
|||||||
Reference in New Issue
Block a user