Search code examples
sqlpostgresqlrds

show timezone - PostgreSQL 11 - different value depending on client?


Postgres 11

show timezone;

This gives me different values
- when I run it from DBeaver (shows America/New_York) vs.
- when I run it from PG Admin (shows UTC)

I run DBeaver and PG Admin from the same client machine.

I thought this was supposed to show me the server timezone.

Same for clock_timestamp() - I get different values.

Is this somehow related to the client OS timezone?
Or to some connection settings?

We're using an AWS RDS PostgreSQL instance which
is configured (as I checked) in UTC timezone.

What is the explanation?
I am really puzzled.


Solution

  • timezone is the timezone of the database session, not of the server.

    It looks like DBeaver sets the parameter, while pgAdmin leaves it at its default value (whatever is configured on the server).

    You can set the PGTZ environment variable to specify your desired PostgreSQL database session time zone.