http://blog.chinaunix.net/uid-15145533-id-2775793.html?_hj_reload_&1435635451087
查看 postgresql 数据库编码,以及修改数据库编码
查看数据表编码:
\encoding
修改数据库编码:
update pg_database set encoding = pg_char_to_encoding('UTF8') where datname = 'dbname';
修改客户短编码:
C:\Program Files\PostgreSQL\11\bin>psql -U postgres -W
口令:
psql (11.2)
输入 "help" 来获取帮助信息.
postgres=# create database mytest3;
CREATE DATABASE
postgres=# \c mytest3;
用户 postgres 的口令:
您现在已经连接到数据库 "mytest3",用户 "postgres".
mytest3=# create extension postgis;
CREATE EXTENSION
mytest3=# show client_encoding;
client_encoding
-----------------
GBK
(1 行记录)
mytest3=# set client_encoding to 'utf8'
mytest3-# ;
SET
mytest3=# show client_encoding;
client_encoding
-----------------
UTF8
(1 行记录)
mytest3=# \q