Thread: Report a bug about timestamp data type

Report a bug about timestamp data type

From
"Mengcheng.Zhong,Tony"
Date:

Hi Postgresql developers:

I have a question very need your confirmation. Here are the detail information.


Postgresql version: 9.4 version, 

Language: Java,

IDE:Eclipse


Sql of the table

CREATE TABLE vldlt (
    id numeric(19,0) NOT NULL,
    pwdexpireson timestamp without time zone
);

The sql to execute

update vldlt set pwdexpireson =  "2018-10-28 02:34:45.078+00" when id = "123"


Here are the steps to reproduce the issue:

First - use the java code below:

           preparementStatement.setTimestamp(1,new Timestamp(new Date(System.currentTimeMillis()).getTime())) ;

Then - execute the preparementStatement.excuteUpdate() mehod to update the pwdexpireson field.

Finally - I get the statement is : update vldlt set pwdexpireson =  "2018-10-28 02:34:45.078+00" :: date when id = "123" and the result will be displayed in Pgadmin tool is '2018-10-28 00:00:00' without millisecond.


I don't know how the why the data type is date, rather than timestamp. In addition, sometimes the result is date, but sometimes is timestamp. 


I think it may be a bug for the check of timestamp data type for postgresql jdbc driver. Would you kindly give me some advice for this issue. 


Best regard,

Tony