Postgres db error: template database “template1” has a collation version, but no actual collation version could be determined

I have recently faced with an error while creating a database in postgres:

template database “template1” has a collation version, but no actual collation version could be determined

Update your template with the following:

ALTER DATABASE template1 REFRESH COLLATION VERSION;

About: author