PostgreSQL - Cannot UPDATE pg_database I am not able to UPDATE table pg_database with user postgres. As you can see below, i am able to run the SQL query, however nothing changes.

postgres=# select datname, datdba, datistemplate, datallowconn from pg_database;
    datname     | datdba | datistemplate | datallowconn
----------------+--------+---------------+--------------
 postgres       |     10 | f             | t
 template1      |     10 | t             | t
 template0      |     10 | t             | f
 my_template_1  |     10 | f             | t
(4 rows)

postgres=# UPDATE pg_database set datistemplate=true, datallowconn=false where datname='my_template_1' ;
UPDATE 1
postgres=# select datname, datdba, datistemplate, datallowconn from pg_database;
    datname     | datdba | datistemplate | datallowconn
----------------+--------+---------------+--------------
 postgres       |     10 | f             | t
 template1      |     10 | t             | t
 template0      |     10 | t             | f
 my_template_1  |     10 | f             | t
(4 rows)

postgres=#
You can't update pg_database to change a database (you shouldn't be updating system tables at all, although you can do it for some of them). 

Use ALTER DATABASE instead:

alter database my_template_1
  with is_template true
       allow_connections false;