1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Revise syntax-error reporting behavior to give pleasant results for

errors in internally-generated queries, such as those submitted by
plpgsql functions.  Per recent discussions with Fabien Coelho.
This commit is contained in:
Tom Lane
2004-03-21 22:29:11 +00:00
parent bee3b2a0a0
commit f938c2b91b
25 changed files with 671 additions and 124 deletions

View File

@ -1,5 +1,5 @@
<!--
$PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.147 2004/03/11 02:39:10 momjian Exp $
$PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.148 2004/03/21 22:29:10 tgl Exp $
-->
<chapter id="libpq">
@ -1390,13 +1390,37 @@ bytes.
</listitem>
</varlistentry>
<varlistentry>
<term><symbol>PG_DIAG_INTERNAL_POSITION</></term>
<listitem>
<para>
This is defined the same as the <symbol>PG_DIAG_STATEMENT_POSITION</>
field, but it is used when the cursor position refers to an internally
generated command rather than the one submitted by the client.
The <symbol>PG_DIAG_INTERNAL_QUERY</> field will always appear when this field
appears.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><symbol>PG_DIAG_INTERNAL_QUERY</></term>
<listitem>
<para>
The text of a failed internally-generated command.
This could be, for example, a SQL query issued by a PL/pgSQL function.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><symbol>PG_DIAG_CONTEXT</></term>
<listitem>
<para>
An indication of the context in which the error occurred. Presently
this includes a call stack traceback of active PL functions. The
trace is one entry per line, most recent first.
An indication of the context in which the error occurred.
Presently this includes a call stack traceback of active
procedural language functions and internally-generated queries.
The trace is one entry per line, most recent first.
</para>
</listitem>
</varlistentry>

View File

@ -1,4 +1,4 @@
<!-- $PostgreSQL: pgsql/doc/src/sgml/protocol.sgml,v 1.50 2004/03/09 16:57:46 neilc Exp $ -->
<!-- $PostgreSQL: pgsql/doc/src/sgml/protocol.sgml,v 1.51 2004/03/21 22:29:10 tgl Exp $ -->
<chapter id="protocol">
<title>Frontend/Backend Protocol</title>
@ -3902,6 +3902,32 @@ message.
</ListItem>
</VarListEntry>
<VarListEntry>
<Term>
<literal>p</>
</Term>
<ListItem>
<Para>
Internal position: this is defined the same as the <literal>P</>
field, but it is used when the cursor position refers to an internally
generated command rather than the one submitted by the client.
The <literal>q</> field will always appear when this field appears.
</Para>
</ListItem>
</VarListEntry>
<VarListEntry>
<Term>
<literal>q</>
</Term>
<ListItem>
<Para>
Internal query: the text of a failed internally-generated command.
This could be, for example, a SQL query issued by a PL/pgSQL function.
</Para>
</ListItem>
</VarListEntry>
<VarListEntry>
<Term>
<literal>W</>
@ -3909,9 +3935,9 @@ message.
<ListItem>
<Para>
Where: an indication of the context in which the error occurred.
Presently this includes a call stack traceback of active
procedural language functions. The trace is one entry per line,
most recent first.
Presently this includes a call stack traceback of active
procedural language functions and internally-generated queries.
The trace is one entry per line, most recent first.
</Para>
</ListItem>
</VarListEntry>