Fix CockroachDB timestampdiff errors caused by `round()` return type

This commit is contained in:
Marco Belladelli 2024-05-15 18:16:30 +02:00
parent d1be36b303
commit ce48a51eaa
2 changed files with 2 additions and 2 deletions

View File

@ -859,7 +859,7 @@ public class CockroachLegacyDialect extends Dialect {
case SECOND:
case NANOSECOND:
case NATIVE:
return "round(extract(epoch from ?3-?2)" + EPOCH.conversionFactor( unit, this ) + ")";
return "round(extract(epoch from ?3-?2)" + EPOCH.conversionFactor( unit, this ) + ")::int";
default:
throw new SemanticException( "unrecognized field: " + unit );
}

View File

@ -861,7 +861,7 @@ public class CockroachDialect extends Dialect {
case SECOND:
case NANOSECOND:
case NATIVE:
return "round(extract(epoch from ?3-?2)" + EPOCH.conversionFactor( unit, this ) + ")";
return "round(extract(epoch from ?3-?2)" + EPOCH.conversionFactor( unit, this ) + ")::int";
default:
throw new SemanticException( "Unrecognized field: " + unit );
}