Today, a netizen asked PostgreSQL9.0 how to debug the function in the group. I remember that there was a plug-in called edb-debugger that was usable in 8.3. There was no 9.0 in hand.
Today, a netizen asked PostgreSQL 9.0 how to debug the function in the group. I remember that there was a plug-in called edb-debugger in 8.3 that was usable. There was no 9.0 in hand.
Today, a netizen asked PostgreSQL 9.0 how to debug functions in the group. I remember there was a plug-in named edb-debugger in 8.3 that could be used. there is no 9.0 database at hand, so I tested it and it could not be used at 9.1. The result is that the compilation failed.
Finally, the solution is found. The record is as follows.
There is an open-source edb-debugger plug-in pgfoundry that can be used to debug PostgreSQL PLPGSQL functions.
However, this version is too old and cannot be compiled in PostgreSQL 9.1. The error is as follows.
Make
Gcc-O2-Wall-Wmissing-prototypes-Wpointer-arith-Wdeclaration-after-statement-Wendif-labels-Wformat-security-fno-strict-aliasing-fwrapv-fpic-I. -I. -I .. /.. /src/include-D_GNU_SOURCE-I/usr/include/libxml2-c-o pldbgapi. o pldbgapi. c
Pldbgapi. c: In function 'pldbg _ attach_to_port ':
Pldbgapi. c: 346: warning: implicit declaration of function 'make _ OFFSET'
Pldbgapi. c: In function 'pldbg _ wait_for_target ':
Pldbgapi. c: 474: warning: implicit declaration of function 'shm _ offset_valid'
Pldbgapi. c: 476: warning: implicit declaration of function 'make _ PTR'
Pldbgapi. c: 476: warning: cast to pointer from integer of different size
Gcc-O2-Wall-Wmissing-prototypes-Wpointer-arith-Wdeclaration-after-statement-Wendif-labels-Wformat-security-fno-strict-aliasing-fwrapv-fpic-L.. /.. /src/port-Wl,-rpath, '/opt/pgsql/lib', -- enable-new-dtags-shared-o pldbgapi. so pldbgapi. o
Gcc-O2-Wall-Wmissing-prototypes-Wpointer-arith-Wdeclaration-after-statement-Wendif-labels-Wformat-security-fno-strict-aliasing-fwrapv-fpic-I. -I. -I .. /.. /src/include-D_GNU_SOURCE-I/usr/include/libxml2-c-o targetinfo. o targetinfo. c
Targetinfo. c: In function 'gettriggerfuncoid ':
Targetinfo. c: 268: error: 'snapshotnow 'undeclared (first use in this function)
Targetinfo. c: 268: error: (Each undeclared identifier is reported only once
Targetinfo. c: 268: error: for each function it appears in .)
Targetinfo. c: In function 'getprocoidbysig ':
Targetinfo. c: 508: error: too few arguments to function 'funcnamegetcandidates'
Targetinfo. c: In function 'getprocoidbyname ':
Targetinfo. c: 555: error: too few arguments to function 'funcnamegetcandidates'
Make: *** [targetinfo. o] Error 1
Rm pldbgapi. o
I don't know why I won't update it. The author is the two.
The EDB-AS version released by EDB contains the debugger.
It is not available to directly copy the so file to the open-source PostgreSQL version.
For example, I copied the $ libdir/plugins/plugin_debugger.so file of EDB-AS 9.1.2.2 to the open source PostgreSQL $ PGHOME/lib/plugins/directory.
Configure postgresql. conf
When the database is started, the following error is reported:
ThisNonSPLFunctionContext in PostgresPlus/9.1AS/include/server/utils/elog. h file.
However, after copying it to the open-source PostgreSQL/opt/pgsql/include/server/utils/elog. h.
Although only version 0.9.3 is available for download in pgfoundry, we are glad that the latest version is available in cvs.
See the reference link. After downloading these files, put them in the contrib directory of the source code to create a new debugger directory.
Compilation process:
Make
Make install
Modify the database configuration file:
Restart the database,
Use the superuser to install functions and classes in the database to be debugged.
CREATE TYPE
CREATE TYPE
CREATE TYPE
CREATE TYPE
CREATE TYPE
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
CREATE FUNCTION
Create a test function:
Use pgAdmin to log on to the database. When you right-click the function, the debugging option is available.
A debugging page:
,