question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can not setup client timezone

See original GitHub issue

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)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:20 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
jbrechtelcommented, Sep 14, 2018

@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.

1reaction
jbrechtelcommented, Sep 12, 2018

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't set time zone automatically - Windows Client
Can't set time zone automatically in Windows 10 · Use Registry Editor. Run Registry Editor as an administrator and follow these steps: ·...
Read more >
Troubleshooting Client Time Zone Issues
When Client Time Zone is enabled, the client passes its time zone information (not the clock time) to the server. The server obtains...
Read more >
If you can't change the time or time zone on your Apple device
To do this, go to Settings > Privacy & Security > Location Services > System Services and turn on Setting Time Zone. Check...
Read more >
Remote client copy - system's time zone cannot be determined
Hello, During Remote client copy , I got error "THe system's time zone cannot be determined. Enter it using STZAC" and remote client...
Read more >
When I connect to a Cloud Access Software session the time ...
Ensure the time zone is correctly set on the client. A PCoIP Zero Client's time zone maybe set through the AWI or Teradici...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found