为什么在使用JDBC时,PostgreSQL 12中的current_time与current_timestamp和now()都不同?

为什么在使用JDBC时,PostgreSQL 12中的current_time与current_timestamp和now()都不同?,postgresql,jdbc,time,Postgresql,Jdbc,Time,当我在PgAdmin4或psql中运行以下查询时,我得到了与current\u time、now()和current\u timestamp相同的值: SELECT now(), CURRENT_TIME, CURRENT_TIMESTAMP; now | current_time | current_timestamp -------------------------------+-----------------

当我在PgAdmin4或psql中运行以下查询时,我得到了与
current\u time
now()
current\u 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
now                |current_time|current_timestamp  |
-------------------|------------|-------------------|
2020-04-27 12:57:00|    11:57:00|2020-04-27 12:57:00|
但是,当我使用JDBC驱动程序连接到同一个PostgreSQL数据库,从DBeaver内部运行相同的查询时,
current\u time
now()
(和
current\u timestamp
)之间存在差异:

显然,JDBC驱动程序在某种程度上造成了
current\u time
current\u timestamp
之间的差异

我的问题是:

  • 这是JDBC驱动程序的预期行为吗?(为什么?)
  • 有没有一种方法可以通过JDBC驱动程序本身的一些配置来控制这种行为,而无需修改依赖JDBC驱动程序的应用程序和查询

当前时间
是带有时区的
时间
JDBC不支持的时间

应用程序需要采取特殊步骤来正确检索该值。所以,是的,这在某种程度上是意料之中的。我猜DBEaver使用
getTime()
返回UTC时间


这就是为什么使用
current\u time

current\u time
是一个带有时区的
时间,JDBC不支持它

应用程序需要采取特殊步骤来正确检索该值。所以,是的,这在某种程度上是意料之中的。我猜DBEaver使用
getTime()
返回UTC时间

这是使用
current\u time