How I changed the encoding of template1 after the fact
От | Kevin Murphy |
---|---|
Тема | How I changed the encoding of template1 after the fact |
Дата | |
Msg-id | 43FE1E65.3030000@genome.chop.edu обсуждение исходный текст |
Ответы |
Re: How I changed the encoding of template1 after the fact
|
Список | pgsql-general |
I wanted to change the encoding of the template1 database, but when I tried to drop template1, I get the message, "ERROR: cannot drop a template database". The docs (http://www.postgresql.org/docs/8.1/interactive/manage-ag-templatedbs.html) say that this is possible, but a user comment on that page says you can't. Actually, you *can* drop a template database, if you first convert it into a non-template database, as per http://techdocs.postgresql.org/techdocs/pgsqladventuresep1.php Here's a condensed example, in which template1 is recreated to change its default encoding: -- Connect as the postgres superuser, e.g.: -- psql -U postgres template1 -- Then run: UPDATE pg_database SET datallowconn = TRUE where datname = 'template0'; \c template0 UPDATE pg_database SET datistemplate = FALSE where datname = 'template1'; drop database template1; create database template1 with template = template0 encoding = 'UNICODE'; UPDATE pg_database SET datistemplate = TRUE where datname = 'template1'; \c template1 UPDATE pg_database SET datallowconn = FALSE where datname = 'template0'; If you just wanted to clone template0, you would leave out the "encoding = 'UNICODE'" clause. Gurus, any corrections or safety advisories you care to make? Kevin Murphy
В списке pgsql-general по дате отправления: