"Nikolay Samokhvalov" <[EMAIL PROTECTED]> writes:
> On 12/24/06, Tom Lane <[EMAIL PROTECTED]> wrote:
>> What I'm wondering about is why this printout is emitted as a separate
>> DEBUG message ... wouldn't it be better to incorporate it as the DETAIL
>> field of the error message?

> Surely, it would. But the thing is that I couldn't manage to format
> libxml2's native messages properly..

I'm not really seeing the problem.  Right now I'm getting results like
this:

regression=# \set VERBOSITY verbose
regression=# set client_min_messages TO debug1;
SET
regression=# select '<foo><zit'::xml;
DEBUG:  00000: Entity: line 1: parser error : Couldn't find end of Start Tag 
zit line 1
<foo><zit
         ^
Entity: line 1: parser error : Premature end of data in tag foo line 1
<foo><zit
         ^

LOCATION:  xml_ereport_by_code, xml.c:685
ERROR:  2200M: could not parse XML data
DETAIL:  Closing tag not found
LOCATION:  xml_ereport_by_code, xml.c:857
regression=# select '<?xml><foo><zit'::xml;
DEBUG:  00000: dummy.xml:1: parser error : XML declaration allowed only at the 
start of the document
<?xml><foo><zit
     ^
dummy.xml:1: parser error : ParsePI: PI xml space expected
<?xml><foo><zit
     ^
dummy.xml:1: parser error : ParsePI: PI xml never end ...
<?xml><foo><zit
               ^
dummy.xml:1: parser error : Start tag expected, '<' not found
<?xml><foo><zit
               ^

LOCATION:  xml_ereport, xml.c:611
ERROR:  2200M: could not parse XML data
DETAIL:  Start tag expected, '<' not found.
LOCATION:  xml_ereport, xml.c:641
regression=# 

I claim the libxml output is just fine as-is for a DETAIL message, and
we could get rid of all the pushups being done in the two versions of
xml_ereport to generate a detail message that's really insufficiently
detailed anyway.  In particular, in any respectable-size chunk of XML
I think you'd *really* want some kind of error cursor position, which
the libxml output gives you.

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Reply via email to