<?xml version="1.0" encoding="iso-8859-1"?> <!-- $Revision: 1.3 $ --> <!-- splitted from ./en/functions/pgsql.xml, last change in rev 1.7 --> <refentry id="function.pg-trace"> <refnamediv> <refname>pg_trace</refname> <refpurpose>Enable tracing a PostgreSQL connection</refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> <type>bool</type><methodname>pg_trace</methodname> <methodparam><type>string</type><parameter>pathname</parameter></methodparam> <methodparam choice="opt"><type>string</type><parameter>mode</parameter></methodparam> <methodparam choice="opt"><type>resource</type><parameter>connection</parameter></methodparam> </methodsynopsis> <para> <function>pg_trace</function> enables tracing of the PostgreSQL frontend/backend communication to a debugging file specified as <parameter>pathname</parameter>. To fully understand the results, one needs to be familiar with the internals of PostgreSQL communication protocol. For those who are not, it can still be useful for tracing errors in queries sent to the server, you could do for example <command>grep '^To backend' trace.log</command> and see what query actually were sent to the PostgreSQL server. For more information, refer to PostgreSQL manual. </para> <para> <parameter>pathname</parameter> and <parameter>mode</parameter> are the same as in <function>fopen</function> (<parameter>mode</parameter> defaults to 'w'), <parameter>connection</parameter> specifies the connection to trace and defaults to the last one opened. </para> <para> It returns &true; if <parameter>pathname</parameter> could be opened for logging, &false; otherwise. </para> <para> See also <function>fopen</function> and <function>pg_untrace</function>. </para> </refsect1> </refentry> <!-- Keep this comment at the end of the file Local variables: mode: sgml sgml-omittag:t sgml-shorttag:t sgml-minimize-attributes:nil sgml-always-quote-attributes:t sgml-indent-step:1 sgml-indent-data:t indent-tabs-mode:nil sgml-parent-document:nil sgml-default-dtd-file:"../../../../manual.ced" sgml-exposed-tags:nil sgml-local-catalogs:nil sgml-local-ecat-files:nil End: vim600: syn=xml fen fdm=syntax fdl=2 si vim: et tw=78 syn=sgml vi: ts=1 sw=1 -->