pg_config
是一个 服务器实用程序,提供有关已安装的 PostgreSQL 版本的构建方式的信息。
pg_config
添加于 PostgreSQL 7.1。
用法
pg_config
列出当前安装的 PostgreSQL 版本的配置参数。默认情况下,所有参数都会被转储,但是可以使用相应的选项指定单个参数,例如 --bindir
。
从 PostgreSQL 9.6 开始,这些值也可以直接从同名视图 pg_config
中查询。
变更历史
- PostgreSQL 9.0
- 添加了
--ldflags_ex
选项 (提交 291a9577)
- 添加了
- PostgreSQL 8.4
- 添加了
--htmldir
选项 (提交 84ce707b)
- 添加了
- PostgreSQL 8.1
- PostgreSQL 7.1
- 添加 (提交 93141411)
示例
未指定任何选项时的 pg_config
输出示例
$ pg_config BINDIR = /usr/local/pgsql/bin DOCDIR = /usr/local/pgsql/share/doc HTMLDIR = /usr/local/pgsql/share/doc INCLUDEDIR = /usr/local/pgsql/include PKGINCLUDEDIR = /usr/local/pgsql/include INCLUDEDIR-SERVER = /usr/local/pgsql/include/server LIBDIR = /usr/local/pgsql/lib PKGLIBDIR = /usr/local/pgsql/lib LOCALEDIR = /usr/local/pgsql/share/locale MANDIR = /usr/local/pgsql/share/man SHAREDIR = /usr/local/pgsql/share SYSCONFDIR = /usr/local/pgsql/etc PGXS = /usr/local/pgsql/lib/pgxs/src/makefiles/pgxs.mk CONFIGURE = '--prefix=/usr/local/pgsql' CC = gcc CPPFLAGS = -D_GNU_SOURCE CFLAGS = -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Wendif-labels -Wmissing-format-attribute -Wimplicit-fallthrough=3 -Wformat-security -fno-strict-aliasing -fwrapv -fexcess-precision=standard -Wno-format-truncation -O2 CFLAGS_SL = -fPIC LDFLAGS = -Wl,--as-needed -Wl,-rpath,'/usr/local/pgsql/lib',--enable-new-dtags LDFLAGS_EX = LDFLAGS_SL = LIBS = -lpgcommon -lpgport -lz -lreadline -lpthread -lrt -ldl -lm VERSION = PostgreSQL 14devel
指定单个选项
$ pg_config --bindir /usr/local/pgsql/bin
指定多个选项
$ pg_config --cc --version gcc PostgreSQL 14devel
参考文献
- PostgreSQL 文档: pg_config