Postgres module

set_trace

procedure · 1 overloadsince 0.27.0Source

Starts tracing: proc gets a line per message from now on (null stops). With regress, the output is libpq's PQTRACE_SUPPRESS_TIMESTAMPS | PQTRACE_REGRESS_MODE: OIDs, process ids and the server's source locations are replaced by fixed text, and an error's length by NN, so a trace is the same from one server run to the next. Without it they show as they are.

F<TAB>21<TAB>Parse<TAB> "" "SELECT $1" 1 NNNN
B<TAB>5<TAB>ReadyForQuery<TAB> I

F is a message the client sent, B one it received. Messages sent while connecting are not traced, as the trace starts after connect.

set_trace :: (
    c: *Connection,
    proc: Trace_Proc,
    data: *void = null,
    regress := true
)

Starts tracing: proc gets a line per message from now on (null stops). With regress, the output is libpq's PQTRACE_SUPPRESS_TIMESTAMPS | PQTRACE_REGRESS_MODE: OIDs, process ids and the server's source locations are replaced by fixed text, and an error's length by NN, so a trace is the same from one server run to the next. Without it they show as they are.

F is a message the client sent, B one it received. Messages sent while connecting are not traced, as the trace starts after connect.

Parameters

c: *Connection
the connection to trace.
proc: Trace_Proc
gets each line; null stops tracing.
data: *void
kept in the connection's trace_data, for proc to read.
regress := true
replace values that change between runs with fixed text.
F<TAB>21<TAB>Parse<TAB> "" "SELECT $1" 1 NNNN
B<TAB>5<TAB>ReadyForQuery<TAB> I