Reputation: 8521
When I run the following query in PgAdmin4 or psql, I get the same values for current_time
, now()
, and current_timestamp
:
SELECT now(), CURRENT_TIME, CURRENT_TIMESTAMP;
now | current_time | current_timestamp
-------------------------------+--------------------+-------------------------------
2020-04-27 11:54:55.443006+01 | 11:54:55.443006+01 | 2020-04-27 11:54:55.443006+01
But when I run the same query from within DBeaver by connecting to the same PostgreSQL database, using JDBC driver, there's a difference between current_time
and now()
(and current_timestamp
):
now |current_time|current_timestamp |
-------------------|------------|-------------------|
2020-04-27 12:57:00| 11:57:00|2020-04-27 12:57:00|
Obviously, the JDBC driver is somehow creating a discrepancy between current_time
and current_timestamp
.
My questions:
Upvotes: 0
Views: 629
Reputation:
current_time
is a time WITH time zone
something that is not supported by JDBC.
Applications need to take special steps to retrieve that value correctly. So, yes this is somewhat expected. I guess DBEaver uses getTime()
which returns the time as UTC
That's one of the reasons the use of current_time
is discouraged
Upvotes: 2