为postgreSQL添加man帮助

作者:瀚高PG实验室 (Highgo PG Lab)- 徐云鹤

      在解压postgreSQL的源码后,通过源码或编译好的二进制文件安装完postgreSQL后,通过yum或者rpm安装完postgreSQL后,会生成man手册,通过这个手册可以在手头没有对应版本的官方手册或者没有图形化环境的时候,快速并极其方便的查询PG的命令,库函数和语法的含义及使用。

方法很简单,通过修改man的配置文件即可。在man的配置文件中添加:

MANPATH /usr/local/pgsql/share/man


不同的系统man的配置文件可能会不同。

常见的为以下几种情况:

/etc/man.config

/etc/manpath.config

/etc/man_db.config

通过不同的方式安装,man手册位置也会有所不同,

默认的

源码解压后在./postgresql-xxx/doc/src/sgml下。

源码安装后在/usr/local/pgsql/share/man下。

编译好的二进制文件安装后在/opt/PostgreSQL/版本号/share/man下。

yum或者rpm安装完后在/usr/local/pgsql/share/man下,这种情况下是不需要修改man配置文件的。

添加完后看下效果:

[root@pg ~]# man psql
PSQL(1)                 PostgreSQL 9.4.14 Documentation                PSQL(1)

NAME
       psql - PostgreSQL interactive terminal

SYNOPSIS
       psql [option...] [dbname [username]]

DESCRIPTION
       psql is a terminal-based front-end to PostgreSQL. It enables you to type in queries interactively, issue them to PostgreSQL, and see the query
       results. Alternatively, input can be from a file. In addition, it provides a number of meta-commands and various shell-like features to
       facilitate writing scripts and automating a wide variety of tasks.

[root@pg ~]# man 3 dblink
DBLINK(3)               PostgreSQL 9.4.14 Documentation              DBLINK(3)

NAME
       dblink - executes a query in a remote database

SYNOPSIS
       dblink(text connname, text sql [, bool fail_on_error]) returns setof record
       dblink(text connstr, text sql [, bool fail_on_error]) returns setof record

[root@pg ~]# man 7 CREATE_DATABASE
CREATE DATABASE(7)      PostgreSQL 9.4.14 Documentation     CREATE DATABASE(7)

NAME
       CREATE_DATABASE - create a new database

SYNOPSIS
       CREATE DATABASE name
           [ [ WITH ] [ OWNER [=] user_name ]
                  [ TEMPLATE [=] template ]
                  [ ENCODING [=] encoding ]
                  [ LC_COLLATE [=] lc_collate ]
                  [ LC_CTYPE [=] lc_ctype ]
                  [ TABLESPACE [=] tablespace_name ]
                  [ CONNECTION LIMIT [=] connlimit ] ]

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值