Should timezone be inherited from template database?

Started by Anton A. Melnikovabout 2 years ago3 messages
#1Anton A. Melnikov
a.melnikov@postgrespro.ru

Hello!

Found that if i set a specific time zone for a template database,
it will not be inherited in the database created from that template.

psql (17devel)
Type "help" for help.

postgres=# select now();
now
-------------------------------
2023-11-26 17:24:58.242086+03
(1 row)

postgres=# ALTER DATABASE template1 SET TimeZone = 'UTC';
ALTER DATABASE
postgres=# \c template1
You are now connected to database "template1" as user "postgres".
template1=# select now();
now
-------------------------------
2023-11-26 14:26:09.291082+00
(1 row)

template1=# CREATE DATABASE test;
CREATE DATABASE
template1=# \c test
You are now connected to database "test" as user "postgres".
test=# select now();
now
-------------------------------
2023-11-26 17:29:05.487984+03
(1 row)

Could you clarify please. Is this normal, predictable behavior?

Would be very grateful!

--
Anton A. Melnikov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

#2David G. Johnston
david.g.johnston@gmail.com
In reply to: Anton A. Melnikov (#1)
Re: Should timezone be inherited from template database?

On Sun, Nov 26, 2023 at 7:47 AM Anton A. Melnikov <a.melnikov@postgrespro.ru>
wrote:

postgres=# ALTER DATABASE template1 SET TimeZone = 'UTC';

Could you clarify please. Is this normal, predictable behavior?

https://www.postgresql.org/docs/current/sql-createdatabase.html

Database-level configuration parameters (set via ALTER DATABASE) and
database-level permissions (set via GRANT) are not copied from the template
database.

David J.

#3Anton A. Melnikov
a.melnikov@postgrespro.ru
In reply to: David G. Johnston (#2)
Re: Should timezone be inherited from template database?

On 26.11.2023 18:53, David G. Johnston wrote:

https://www.postgresql.org/docs/current/sql-createdatabase.html <https://www.postgresql.org/docs/current/sql-createdatabase.html&gt;

 Database-level configuration parameters (set via ALTER DATABASE) and database-level permissions (set via GRANT) are not copied from the template database.

Clear. Thank you very much!

With the best wishes,

--
Anton A. Melnikov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company