From f938c2b91bebb7f436a3615cf86347d7261f71e8 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 21 Mar 2004 22:29:11 +0000 Subject: 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. --- doc/src/sgml/libpq.sgml | 32 ++++++++++++++++++++++++++++---- doc/src/sgml/protocol.sgml | 34 ++++++++++++++++++++++++++++++---- 2 files changed, 58 insertions(+), 8 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml index 82b8099a4a0..ee30b0d7e57 100644 --- a/doc/src/sgml/libpq.sgml +++ b/doc/src/sgml/libpq.sgml @@ -1,5 +1,5 @@ @@ -1390,13 +1390,37 @@ bytes. + +PG_DIAG_INTERNAL_POSITION + + +This is defined the same as the 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 PG_DIAG_INTERNAL_QUERY field will always appear when this field +appears. + + + + + +PG_DIAG_INTERNAL_QUERY + + +The text of a failed internally-generated command. +This could be, for example, a SQL query issued by a PL/pgSQL function. + + + + PG_DIAG_CONTEXT -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. diff --git a/doc/src/sgml/protocol.sgml b/doc/src/sgml/protocol.sgml index a4baff82a4b..de3b72738d7 100644 --- a/doc/src/sgml/protocol.sgml +++ b/doc/src/sgml/protocol.sgml @@ -1,4 +1,4 @@ - + Frontend/Backend Protocol @@ -3902,6 +3902,32 @@ message. + + +p + + + + Internal position: this is defined the same as the 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 q field will always appear when this field appears. + + + + + + +q + + + + Internal query: the text of a failed internally-generated command. + This could be, for example, a SQL query issued by a PL/pgSQL function. + + + + W @@ -3909,9 +3935,9 @@ message. 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. -- cgit v1.2.3