Home > PHP > Function > PostgreSQL > pg_trace()

pg_trace()

pg_trace - Enable tracing a PostgreSQL connection

Syntax

bool pg_trace (string $pathname, string $mode, resource $connection)

Arguments

  • pathname - The full path and file name of the file in which to write the trace log. Same as in fopen().
  • mode - An optional file access mode, same as for fopen().
  • connection - PostgreSQL database connection resource. When connection is not present, the default connection is used. The default connection is the last connection made by pg_connect() or pg_pconnect().

Description

pg_trace() enables tracing of the PostgreSQL frontend/backend communication to a file. To fully understand the results, one needs to be familiar with the internals of PostgreSQL communication protocol.

Version

PHP 4.0.1, 5

Return value

Returns TRUE on success or FALSE on failure.