Permalink
Browse files

test: workaround DST issue in StatementTest#testDateFunctions

  • Loading branch information...
vlsi committed Mar 11, 2018
1 parent fcd1ea1 commit af499625fb99043fe0bf605ec4b23f3dd64c18d7
Showing with 19 additions and 1 deletion.
  1. +19 −1 pgjdbc/src/test/java/org/postgresql/test/jdbc2/StatementTest.java
@@ -383,7 +383,25 @@ public void testDateFunctions() throws SQLException {
rs = stmt.executeQuery(
"select {fn timestampdiff(SQL_TSI_DAY,{fn now()},{fn timestampadd(SQL_TSI_DAY,-3,{fn now()})})} ");
assertTrue(rs.next());
assertEquals(-3, rs.getInt(1));
int res = rs.getInt(1);
if (res != -3 && res != -2) {
// set TimeZone='America/New_York';
// select CAST(-3 || ' day' as interval);
// interval
//----------
// -3 days
//
// select CAST(-3 || ' day' as interval)+now();
// ?column?
//-------------------------------
// 2018-03-08 07:59:13.586895-05
//
// select CAST(-3 || ' day' as interval)+now()-now();
// ?column?
//-------------------
// -2 days -23:00:00
fail("CAST(-3 || ' day' as interval)+now()-now() is expected to return -3 or -2. Actual value is " + res);
}
// WEEK => extract week from interval is not supported by backend
// rs = stmt.executeQuery("select {fn timestampdiff(SQL_TSI_WEEK,{fn now()},{fn
// timestampadd(SQL_TSI_WEEK,3,{fn now()})})} ");

0 comments on commit af49962

Please sign in to comment.