assertions for extract(offset hour/minute)

Signed-off-by: Gavin King <gavin@hibernate.org>
This commit is contained in:
Gavin King 2024-05-02 18:38:16 +02:00
parent 8c6241a7d7
commit 98b014c789
1 changed files with 15 additions and 0 deletions

View File

@ -1932,6 +1932,21 @@ public class FunctionTests {
);
}
@Test
@RequiresDialectFeature(feature = DialectFeatureChecks.SupportsTimezoneTypes.class)
public void testExtractOffsetHourMinute(SessionFactoryScope scope) {
scope.inTransaction(
session -> {
assertEquals(3,
session.createQuery("select extract(offset hour from offset datetime 2024-2-5 12:30:12+03:12)", Integer.class)
.getSingleResult());
assertEquals(12,
session.createQuery("select extract(offset minute from offset datetime 2024-2-5 12:30:12+03:12)", Integer.class)
.getSingleResult());
}
);
}
@Test
@RequiresDialectFeature(feature = DialectFeatureChecks.SupportsTimezoneTypes.class)
@RequiresDialectFeature(feature = DialectFeatureChecks.SupportsFormat.class, comment = "We extract the offset with a format function")