Vinayak,
A bug, no. An interesting artifact yes.
The problem here is that java dates have timezones and times.
These selects were done in my timezone EST
test=> select date('2005-01-01' at time zone 'gmt+6') ;
date
------------
2004-12-31
(1 row)
test=> select date('2005-01-01' at time zone 'gmt-6') ;
date
------------
2005-01-01
the reason behind this is:
test=> select '2005-01-01' at time zone 'gmt-6';
timezone
---------------------
2005-01-01 11:00:00
(1 row)
test=> select '2005-01-01' at time zone 'gmt+6';
timezone
---------------------
2004-12-31 23:00:00
(1 row)
I am guessing what you really want is to just take the date in your Oracle db, load it into java and store it into postgresql without any transformation.
This would require a custom date type.