dbeaver: Can not setup client timezone

In the conection properties did not find how to setup client’s timezone

Even starting transaction in a tab did not help:

begin;
SET TIME ZONE 'UTC';
select ..... ;

so I get wrong (not desired) results: http://joxi.ru/vAWMwOZI1L0Ejm (sorry, text is not copied)

but in the psql I get for same query:

       startdate        |        enddate         | amount | amount |          valid          
------------------------+------------------------+--------+--------+-------------------------
 2018-08-01 00:00:00+00 | 2018-08-02 00:00:00+00 |     14 |     14 | [2018-08-01,2018-08-02)
 2018-08-02 00:00:00+00 | 2018-08-03 00:00:00+00 |     14 |     14 | [2018-08-02,2018-08-03)
 2018-08-03 00:00:00+00 | 2018-08-04 00:00:00+00 |     14 |     14 | [2018-08-03,2018-08-04)

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 20 (8 by maintainers)

Most upvoted comments

@serge-rider I’m not suggesting that DBeaver is changing the value stored in PostgreSQL.

I’m saying that the combination of the following two facts results in very misleading behavior with DBeaver defaults

  • PostgreSQL has a connection-specific timezone setting which affects how it interprets timestamp values
  • That connection specific timezone settings can be out of sync with the user.timezone System property which affects the timezone that DBeaver translates Postgres’s UTC timestamp values into

To recreate the scenario I’m describing simply launch DBeaver with a user.timezone of something other than UTC (anything with a non-zero UTC offset will do). Potentially your system default is already suitable.

Here’s the problematic SQL

set time zone 'UTC';
create table foo (mydate timestamptz);
insert into foo values ('2018-08-08T12:00:00');
select * from foo;

I’m in EST and I see 2018-08-08 08:00:00.

The value you’ll see (presuming your user.timezone system property is not one with a 00:00 UTC offset) will NOT match the literal you entered. Even IF you specify a +00:00 offset in your timestamp literal then the selected value from the last line will not display as you expect because DBeaver is converting it to your user.timezone.

At the end of the day it simply seems misleading to convert a zero offset value to a non zero offset value and not display the offset you’ve applied.

@KES777 the issue is that DBeaver is formatting the time to your user timezone and then HORRIBLY not including the offset or timezone abbreviation in the output. You should see a timezone abbreviation in the bottom of your status bar that indicates this. This results in very confusion output from UTC datetimes from PostgreSQL as you’re running in to.

I’ve not been able to affect the user.timezone system property with DBeaver command line arguments in Linux.

export JAVA_OPTS="-Duser.timezone=UTC"
export _JAVA_OPTS="-Duser.timezone=UTC"
dbeaver -vmwargs -Duser.timezone=UTC
dbeaver -vmwargs=-Duser.timezone=UTC
dbeaver -vmwargs="-Duser.timezone=UTC"

will all result in DBeaver still reporting the timezone as “EST” upon startup and formatting Timestamps accordingly.

The only way I’ve found that can actually change DBeaver’s timezone is by editing the system dbeaver.ini file to add -Duser.timezone=UTC

It would be a much less confusing default if DBeaver would at least put the timezone name or offset that it is applying to datetime/timestamp values when formatting them.