On an attempt to insert unique dates crossing a DST boundary I receive
a wrong unique constraint violation.

Here is a test case to insert into the TestDataStorage class:

        private void testDST() throws SQLException {
                Connection conn = getConnection("date");
                Statement stat = conn.createStatement();
                TimeZone defaultTimeZone = TimeZone.getDefault();
                stat.execute("create table test(ts timestamp primary key)");
                try {
                        
TimeZone.setDefault(TimeZone.getTimeZone("Europe/Berlin"));
                        Calendar calendar = new 
GregorianCalendar(TimeZone.getDefault());

                        PreparedStatement prep = conn
                                        .prepareStatement("INSERT INTO TEST 
VALUES(?)");
                        prep.setTimestamp(1, new 
java.sql.Timestamp(1162080120000l),
                                        calendar);
                        prep.execute();
                        prep.setTimestamp(1, new 
java.sql.Timestamp(1162083720000l),
                                        calendar);
                        prep.execute();
                } finally {
                        TimeZone.setDefault(defaultTimeZone);
                        DateTimeUtils.resetCalendar();
                }
                conn.close();
                deleteDb("date");
        }

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.

Reply via email to