pg.ddx.io pgsql-jdbc@postgresql.org mailing list archive
help / color / mirror / Atom feed42.2.3 regression in fn timestampadd(SQL_TSI_MINUTE)
3+ messages / 2 participants
[nested] [flat]
Commits from this thread:
2018-07-14 4668f43fa1 fix: treatment of SQL_TSI_YEAR, SQL_TSI_WEEK, SQL_TSI_MINUTE (#1250)
* 42.2.3 regression in fn timestampadd(SQL_TSI_MINUTE)
@ 2018-07-14 05:50 Adam Rauch <adam@labkey.com>
2018-07-14 10:06 ` Re: 42.2.3 regression in fn timestampadd(SQL_TSI_MINUTE) Vladimir Sitnikov <sitnikov.vladimir@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Adam Rauch @ 2018-07-14 05:50 UTC (permalink / raw)
To: pgsql-jdbc
Simple Java 8 test case below outputs different results when run against
the 42.2.2 driver vs. the just released 42.2.3 driver:
PostgreSQL JDBC Driver 42.2.2
PostgreSQL 10.4 database "labkey2"
SQL_TSI_SECOND: 2003-01-01 00:00:03.0
SQL_TSI_MINUTE: 2003-01-01 00:03:00.0
SQL_TSI_HOUR: 2003-01-01 03:00:00.0
PostgreSQL JDBC Driver 42.2.3
PostgreSQL 10.4 database "labkey2"
SQL_TSI_SECOND: 2003-01-01 00:00:03.0
SQL_TSI_MINUTE: 2003-01-01 00:00:03.0
SQL_TSI_HOUR: 2003-01-01 03:00:00.0
SQL_TSI_MINUTE seems to be acting like SQL_TSI_SECOND in 42.2.3.
Thanks,
Adam
import java.sql.*;
public class PGTest
{
public static void main(String[] args)throws SQLException
{
try (Connection conn = (3 == args.length ? DriverManager.getConnection(args[0], args[1], args[2]) : DriverManager.getConnection("jdbc:postgresql://" + args[0] +":" + args[1] +"/" + args[2], args[3], args[4])))
{
DatabaseMetaData dmd = conn.getMetaData();
System.out.println(dmd.getDriverName() +" " + dmd.getDriverVersion());
System.out.println(dmd.getDatabaseProductName() +" " + dmd.getDatabaseProductVersion() +" database \"" + conn.getCatalog() +"\"");
testTimestampAdd("SQL_TSI_SECOND", conn);
testTimestampAdd("SQL_TSI_MINUTE", conn);
testTimestampAdd("SQL_TSI_HOUR", conn);
System.out.flush();
System.out.close();
}
}
private static void testTimestampAdd(String interval, Connection conn)throws SQLException
{
String sql ="SELECT {fn timestampadd(" + interval +", 3, CAST('01 Jan 2003' AS TIMESTAMP))} AS ThreeMinutes";
try (Statement st = conn.createStatement(); ResultSet rs = st.executeQuery(sql))
{
while (rs.next())
System.out.println(interval +": " + rs.getTimestamp(1));
}
}
}
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: 42.2.3 regression in fn timestampadd(SQL_TSI_MINUTE)
2018-07-14 05:50 42.2.3 regression in fn timestampadd(SQL_TSI_MINUTE) Adam Rauch <adam@labkey.com>
@ 2018-07-14 10:06 ` Vladimir Sitnikov <sitnikov.vladimir@gmail.com>
2018-07-15 23:32 ` Re: 42.2.3 regression in fn timestampadd(SQL_TSI_MINUTE) Adam Rauch <adam@labkey.com>
0 siblings, 1 reply; 3+ messages in thread
From: Vladimir Sitnikov @ 2018-07-14 10:06 UTC (permalink / raw)
To: Adam Rauch <adam@labkey.com>; +Cc: pgsql-jdbc
Adam, thanks for the prompt report.
Please feel free to review a suggested fix:
https://github.com/pgjdbc/pgjdbc/pull/1250
Vladimir
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: 42.2.3 regression in fn timestampadd(SQL_TSI_MINUTE)
2018-07-14 05:50 42.2.3 regression in fn timestampadd(SQL_TSI_MINUTE) Adam Rauch <adam@labkey.com>
2018-07-14 10:06 ` Re: 42.2.3 regression in fn timestampadd(SQL_TSI_MINUTE) Vladimir Sitnikov <sitnikov.vladimir@gmail.com>
@ 2018-07-15 23:32 ` Adam Rauch <adam@labkey.com>
0 siblings, 0 replies; 3+ messages in thread
From: Adam Rauch @ 2018-07-15 23:32 UTC (permalink / raw)
To: Vladimir Sitnikov <sitnikov.vladimir@gmail.com>; +Cc: pgsql-jdbc
Vladimir, thanks for the prompt fix!
I've confirmed that 42.2.4 works correctly with our unit tests (which
exercise timestampadd using all the standard constants)... i.e., fix
looks great.
Minor issue: I believe there's a typo in the 42.2.3 known issues section
of the changelogs (/CHANGELOG.md and
/docs/_posts/2018-07-12-42.2.3-release.md): I think "SQL_TSI_MINUTE is
treated as minute" should be "SQL_TSI_MINUTE is treated as second".
Thanks!
Adam
On 7/14/2018 3:06 AM, Vladimir Sitnikov wrote:
> Adam, thanks for the prompt report.
>
> Please feel free to review a suggested fix:
> https://github.com/pgjdbc/pgjdbc/pull/1250
>
> Vladimir
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2018-07-15 23:32 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-07-14 05:50 42.2.3 regression in fn timestampadd(SQL_TSI_MINUTE) Adam Rauch <adam@labkey.com>
2018-07-14 10:06 ` Vladimir Sitnikov <sitnikov.vladimir@gmail.com>
2018-07-15 23:32 ` Adam Rauch <adam@labkey.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox