{"action":"created","issue":{"url":"https://api.github.com/repos/pgjdbc/pgjdbc/issues/456","labels_url":"https://api.github.com/repos/pgjdbc/pgjdbc/issues/456/labels{/name}","comments_url":"https://api.github.com/repos/pgjdbc/pgjdbc/issues/456/comments","events_url":"https://api.github.com/repos/pgjdbc/pgjdbc/issues/456/events","html_url":"https://github.com/pgjdbc/pgjdbc/pull/456","id":122221785,"number":456,"title":"fix of timestamps type information losing for non null timestamp values","user":{"login":"marat-gainullin","id":7835156,"avatar_url":"https://avatars.githubusercontent.com/u/7835156?v=3","gravatar_id":"","url":"https://api.github.com/users/marat-gainullin","html_url":"https://github.com/marat-gainullin","followers_url":"https://api.github.com/users/marat-gainullin/followers","following_url":"https://api.github.com/users/marat-gainullin/following{/other_user}","gists_url":"https://api.github.com/users/marat-gainullin/gists{/gist_id}","starred_url":"https://api.github.com/users/marat-gainullin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marat-gainullin/subscriptions","organizations_url":"https://api.github.com/users/marat-gainullin/orgs","repos_url":"https://api.github.com/users/marat-gainullin/repos","events_url":"https://api.github.com/users/marat-gainullin/events{/privacy}","received_events_url":"https://api.github.com/users/marat-gainullin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-12-15T08:49:12Z","updated_at":"2015-12-15T09:54:31Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/pgjdbc/pgjdbc/pulls/456","html_url":"https://github.com/pgjdbc/pgjdbc/pull/456","diff_url":"https://github.com/pgjdbc/pgjdbc/pull/456.diff","patch_url":"https://github.com/pgjdbc/pgjdbc/pull/456.patch"},"body":"setTimeStamp(int i, Timestamp t, java.util.Calendar cal) method loses information about type of a value.\r\nIt finds a calendar for time soze offset calculations from PGTimestamp only!\r\nInstead, it should use information from a client code (`cal` parameter) or from both sources.\r\nsetNull(int parameterIndex, int sqlType) loses information about type of a timestamp also.\r\n\r\nPlease, fix timestamps type information!"},"comment":{"url":"https://api.github.com/repos/pgjdbc/pgjdbc/issues/comments/164706804","html_url":"https://github.com/pgjdbc/pgjdbc/pull/456#issuecomment-164706804","issue_url":"https://api.github.com/repos/pgjdbc/pgjdbc/issues/456","id":164706804,"user":{"login":"marat-gainullin","id":7835156,"avatar_url":"https://avatars.githubusercontent.com/u/7835156?v=3","gravatar_id":"","url":"https://api.github.com/users/marat-gainullin","html_url":"https://github.com/marat-gainullin","followers_url":"https://api.github.com/users/marat-gainullin/followers","following_url":"https://api.github.com/users/marat-gainullin/following{/other_user}","gists_url":"https://api.github.com/users/marat-gainullin/gists{/gist_id}","starred_url":"https://api.github.com/users/marat-gainullin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marat-gainullin/subscriptions","organizations_url":"https://api.github.com/users/marat-gainullin/orgs","repos_url":"https://api.github.com/users/marat-gainullin/repos","events_url":"https://api.github.com/users/marat-gainullin/events{/privacy}","received_events_url":"https://api.github.com/users/marat-gainullin/received_events","type":"User","site_admin":false},"created_at":"2015-12-15T09:54:31Z","updated_at":"2015-12-15T09:54:31Z","body":"Anyway, such behaviour of JDBC driver leads to unstable work of queries like:\r\n`select t1.* from table1 t1 where ? <= t1.moment and ? >= t1.moment` only with TIMESTAMP JDBC data type. Sometimes server log shows parameter type as DATE instead of TIMESTAMP, While in client JDBC code only `setTimestamp` method is used.\r\nAlso, such behaviour of JDBC driver leads to \"can't determine type of parameter $1\" error in queries like: `select t1.* from table1 t1 where ? is null or t1.moment = ?`, while with other data types such queries work properly. It seems, that JDBC driver simply loses information about type of java.sql.Timestamp and server tries to auto detect it and it can't in expressions like \"? is null\".\r\nRegardless of JDBC spec of method `setTimeStamp(int i, Timestamp t, java.util.Calendar cal)`, using of `setTimeStamp(int i, Timestamp t)` method leads to the same problems. Besides, using of JDBC's `setDate` instead of `setTimeStamp` with null values works properly, because type information in case of `setDate` remains untouched. I understand, that you have problems with TIMESTAMP and TIMESTAMPTZ data types handling because of weekness of JDBC spec, etc. But you should not lose data type information in your JDBC driver anyway.\r\nBesides, using of PG-specific class `PGTimestamp` is possible only in PG-specific code, but not in JDBC compliant program. Do you whant to say, that developers should not use `java.sql.Timestamp` values in theirs JDBC programs?"}}