Re: PreparedStatement.setDate() behavior with OVERLAPS - Mailing list pgsql-jdbc

From Dave Cramer
Subject Re: PreparedStatement.setDate() behavior with OVERLAPS
Date
Msg-id CADK3HHKZcCOQkbtwiRGfOK0nKRX5DzPnzM_DaOL+B8RM8mjh5A@mail.gmail.com
Whole thread Raw
In response to Re: PreparedStatement.setDate() behavior with OVERLAPS  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: PreparedStatement.setDate() behavior with OVERLAPS
List pgsql-jdbc
Here are the comments in the code.

  // We must use UNSPECIFIED here, or inserting a Date-with-timezone into a

        // timestamptz field does an unexpected rotation by the server's TimeZone:

        //

        // We want to interpret 2005/01/01 with calendar +0100 as

        // "local midnight in +0100", but if we go via date it interprets it

        // as local midnight in the server's timezone:


        // template1=# select '2005-01-01+0100'::timestamptz;

        //       timestamptz       

        // ------------------------

        //  2005-01-01 02:00:00+03

        // (1 row)


        // template1=# select '2005-01-01+0100'::date::timestamptz;

        //       timestamptz       

        // ------------------------

        //  2005-01-01 00:00:00+03

        // (1 row)


Apparently while dates don't store timezone information we do accept timezone info in date literals ?


Dave Cramer

dave.cramer(at)credativ(dot)ca
http://www.credativ.ca

On 11 August 2015 at 10:49, Tom Lane <tgl@sss.pgh.pa.us> wrote:
It strikes me that maybe the root problem is that Christopher is doing
things in such an order that the server is asked to parse the SQL string
before the setDate() is done.  Don't know enough details about JDBC to
translate that idea into code, though.

                        regards, tom lane

pgsql-jdbc by date:

Previous
From: Tom Lane
Date:
Subject: Re: PreparedStatement.setDate() behavior with OVERLAPS
Next
From: Tom Lane
Date:
Subject: Re: PreparedStatement.setDate() behavior with OVERLAPS