加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Postgresql学习笔记 --- PG::Error: ERROR: new encoding (UTF8)

发布时间:2020-12-13 17:01:05 所属栏目:百科 来源:网络整理
导读:解决方案: First,we need to drop template1. Templates can’t be dropped,so we first modify it so t’s an ordinary database: UPDATE pg_database SET datistemplate = FALSE WHERE datname = 'template1'; Now we can drop it: DROP DATABASE templat

解决方案:

  1. First,we need to drop template1. Templates can’t be dropped,so we first modify it so t’s an ordinary database:

    UPDATE pg_database SET datistemplate = FALSE WHERE datname = 'template1';

  2. Now we can drop it:

    DROP DATABASE template1;

  3. Now its time to create database from template0,with a new default encoding:

    CREATE DATABASE template1 WITH TEMPLATE = template0 ENCODING = 'UNICODE';

  4. Now modify template1 so it’s actually a template:

    UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template1';

  5. Now switch to template1 and VACUUM FREEZE the template:

    VACUUM FREEZE;

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读