psql使用备注
执行
psql -h 主机名 -U 用户名 -d 数据库名
显示命令
\?
显示数据库
\l
连接(使用)数据库
\c 数据库名
显示数据表
\dt
显示数据表结构
\d 数据表名
取消分页显示结果
pset pager
显示SQL执行时间
timing
执行
psql -h 主机名 -U 用户名 -d 数据库名
显示命令
\?
显示数据库
\l
连接(使用)数据库
\c 数据库名
显示数据表
\dt
显示数据表结构
\d 数据表名
取消分页显示结果
pset pager
显示SQL执行时间
timing
问题:
org.postgresql.util.PSQLException: Cannot commit when autoCommit is enabled.
解决:
jdbc autoCommit = true
PostgreSQL 9下有个表中的字段需要修改类型,从smallint改为integer 执行SQL语句出错:
alter table player_street alter column people_cap type integer;
ERROR: cannot alter type of a column used by a view or rule
DETAIL: rule _RETURN on view player_street_v depends on column “people_cap”
********** Error **********
ERROR: cannot alter type of a column used by a view or rule
SQL ...
1、安装编译需要的软件和库文件
sudo yum install gcc gcc-c++ automake readline-devel zlib-devel
2、添加postgres用户和postgres组
sudo useradd postgres # 自动建立 postgres 组
或者
sudo useradd -g postgres postgres
设置密码
sudo passwd postgres
3、从官方下载源代码 下载地址:http://www.postgresql.org/ftp/source/ 4、解压缩,开始编译安装
tar jvxf postgresql-9.0.1.tar.bz2
cd postgresql-9.0 ...