HHH-16082 - Correction to the epoch extraction for DB2

Signed-off-by: Jan Schatteman <jschatte@redhat.com>
This commit is contained in:
Jan Schatteman 2023-02-15 21:19:37 +01:00 committed by Jan Schatteman
parent 20c901ff91
commit 2019fca0cb
1 changed files with 6 additions and 0 deletions

View File

@ -1012,6 +1012,12 @@ public class DB2Dialect extends Dialect {
return "dayofweek(?2)";
case QUARTER:
return "quarter(?2)";
case EPOCH:
if ( getDB2Version().isBefore( 11 ) ) {
return timestampdiffPattern( TemporalUnit.SECOND, TemporalType.TIMESTAMP, TemporalType.TIMESTAMP )
.replace( "?2", "'1970-01-01 00:00:00'" )
.replace( "?3", "?2" );
}
}
return super.extractPattern( unit );
}