Prerequisite
- Having a running instance of Postgresql server and (having it surely installed beside of AGE and debug flag is enabled)
The following commands are used for loading AGE
CREATE EXTENSION age;
LOAD ‘age’;
SET search_path = ag_catalog, "$user", public;
STEPS
- Open a psql session on a terminal
# create a test db if not having one
/usr/local/pgsql/bin/createdb test
# open psql
/usr/local/pgsql/bin/psql test
- Open a new tab for having gdb there
sudo gdb
- Get the backend process's pid
SELECT pg_backend_pid();
- assume output is 666
- Attach gdb to that process id
(gdb) attach 666
- Create break line at some where
(gdb) break src/backend/tcop/postgres.c:4483
- Execute a query at the backend session
select * from t where id > 1 and id < 10;
- Trace at the GDB (press n)
Quick guide to GDB
- To attach to a process: sudo gdb -p
- Attach breakpoint: break :
- Run until breakpoint: c
- Single step into the function: s
- Step over the function: n
- Print a value: p or p *
- Call a function: call
- Print postgres node: call pprint()
- Pressing enter key repeats last command.
- Include directory (source code): dir
References & Resources
Top comments (0)