-1

I use set timezone='UTC'

enter image description here

And I check the database ,but it's still with time +8 :

enter image description here

So I reopen the terminal,it still show my timezone is ROC Why is set timezone not work,Please guide me

enter image description here

user2492364
  • 6,543
  • 22
  • 77
  • 147

1 Answers1

0

It does work, exactly as advertised.

Refer to the documentation for SET:

SET only affects the value used by the current session..

[..SESSION] Specifies that the command takes effect for the current session. (This is the default if neither SESSION nor LOCAL appears.)

Each psql client connection establishes a new session that is terminated when the client disconnets.

See this answer for how to actually set a "server default", which may or may not be what the real goal is.

Community
  • 1
  • 1
user2864740
  • 60,010
  • 15
  • 145
  • 220