postgresql函数调试工具pldebugger安装过程

前端之家收集整理的这篇文章主要介绍了postgresql函数调试工具pldebugger安装过程前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1.下载pldebugger安装包:

http://git.postgresql.org/gitweb/ 所有第三方插件都可在此下载,此处下载pldebugger.git

2.拷贝,安装
将下载好的压缩包(pldebugger-14c6caf.tar.gz)拷贝到postgresql安装目录contrib。
解压:

tarzxvfpldebugger-14c6caf.tar.gz

查看reademe文件,看安装要求:

Installation
------------
-Copythisdirectorytocontrib/inyourPostgresqlsourcetree.
-Run'make;makeinstall'
-Edityourpostgresql.conffile,andmodifytheshared_preload_librariesconfig
optiontolooklike:
shared_preload_libraries='$libdir/plugin_debugger'
-RestartPostgresqlforthenewsettingtotakeeffect.
-RunthefollowingcommandinthedatabaSEOrdatabasesthatyouwishto
debugfunctionsin:
CREATEEXTENSIONpldbgapi;
(onserverversionsolderthan9.1,youmustinsteadrunthepldbgapi--1.0.sql
scriptdirectlyusingpsql).

从以上可以看到,只需make&make install,然后进行配置等。按以上要求具体安装如下:

[root@localhostpldebugger-14c6caf]#make
gcc-Wall-Wmissing-prototypes
-Wpointer-arith-Wdeclaration-after-statement-Wendif-labels
-Wmissing-format-attribute-Wformat-security-fno-strict-aliasing
-fwrapv-O2-fpic-I../../src/pl/plpgsql/src-I.-I.-I../../src/include
-D_GNU_SOURCE-c-oplpgsql_debugger.oplpgsql_debugger.c
gcc
-Wall-Wmissing-prototypes-Wpointer-arith
-Wdeclaration-after-statement-Wendif-labels-Wmissing-format-attribute
-Wformat-security-fno-strict-aliasing-fwrapv-O2-fpic-I.-I.
-I../../src/include-D_GNU_SOURCE-c-oplugin_debugger.o
plugin_debugger.c
gcc-Wall
-Wmissing-prototypes-Wpointer-arith-Wdeclaration-after-statement
-Wendif-labels-Wmissing-format-attribute-Wformat-security
-fno-strict-aliasing-fwrapv-O2-fpic-I.-I.-I../../src/include
-D_GNU_SOURCE-c-odbgcomm.odbgcomm.c
gcc
-Wall-Wmissing-prototypes-Wpointer-arith
-Wdeclaration-after-statement-Wendif-labels-Wmissing-format-attribute
-Wformat-security-fno-strict-aliasing-fwrapv-O2-fpic-I.-I.
-I../../src/include-D_GNU_SOURCE-c-opldbgapi.opldbgapi.c
gcc
-Wall-Wmissing-prototypes-Wpointer-arith
-Wdeclaration-after-statement-Wendif-labels-Wmissing-format-attribute
-Wformat-security-fno-strict-aliasing-fwrapv-O2-fpic-shared-o
plugin_debugger.soplpgsql_debugger.oplugin_debugger.odbgcomm.o
pldbgapi.o-L../../src/port-L../../src/common-Wl,--as-needed
-Wl,-rpath,'/usr/local/pgsql9.5.0/lib',--enable-new-dtags
[root@localhostpldebugger-14c6caf]#makeinstall
/bin/mkdir-p'/usr/local/pgsql9.5.0/lib'
/bin/mkdir-p'/usr/local/pgsql9.5.0/share/extension'
/bin/mkdir-p'/usr/local/pgsql9.5.0/share/extension'
/bin/mkdir-p'/usr/local/pgsql9.5.0/share/doc//extension'
/usr/bin/install-c-m755plugin_debugger.so'/usr/local/pgsql9.5.0/lib/plugin_debugger.so'
/usr/bin/install-c-m644./pldbgapi.control'/usr/local/pgsql9.5.0/share/extension/'
/usr/bin/install-c-m644./pldbgapi--1.0.sql./pldbgapi--unpackaged--1.0.sql'/usr/local/pgsql9.5.0/share/extension/'
/usr/bin/install-c-m644./README.pldebugger'/usr/local/pgsql9.5.0/share/doc//extension/'

安装完成以后该插件被安装在postgresql目录的Lib文件中,查看lib目录可以看到:

-bash-4.1$ll|grepdebug
-rwxr-xr-x.1rootroot62025Mar1009:09plugin_debugger.so

配置参数:

按以上说明设置以下:

shared_preload_libraries='$libdir/plugin_debugger'

*此处注意在配置参数shared_preload_libraries = '$libdir/plugin_debugger'时,如果该参数有多个,只需加逗号即可,如

shared_preload_libraries='xxxxxx,$libdir/plugin_debugger'

* shared_preload_libraries 的路径实际便是postgres的安装路径,在make install完毕后会提示,比如上面的make install安装提示:/usr/bin/install -c -m 755 plugin_debugger.so '/usr/local/pgsql9.5.0/lib/plugin_debugger.so' 后面的路径即为 shared_preload_libraries,所有将 shared_preload_libraries =‘/usr/local/...‘也是可以的。

重启数据库,到需要进行函数调试数据库中执行CREATE EXTENSION pldbgapi;
注意:每次换一个库时,都要重新执行。


经过以上过程,打开pgadmin,选择某个函数可以看到如下:

出现了调试功能,安装成功。

原文链接:https://www.f2er.com/postgresql/194634.html

猜你在找的Postgre SQL相关文章