Re: [BUGS] BUG #4822: xmlattributes encodes '&' twice - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [BUGS] BUG #4822: xmlattributes encodes '&' twice
Date
Msg-id 28781.1243789244@sss.pgh.pa.us
Whole thread Raw
In response to Re: [BUGS] BUG #4822: xmlattributes encodes '&' twice  (Itagaki Takahiro <itagaki.takahiro@oss.ntt.co.jp>)
Responses Re: [BUGS] BUG #4822: xmlattributes encodes '&' twice  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
Itagaki Takahiro <itagaki.takahiro@oss.ntt.co.jp> writes:
> Here is a patch to fix the bug. I added a parameter 'encode' to
> map_sql_value_to_xml_value() and pass false for xml attributes.

One thing I was wondering about, which is sort of highlighted by your
patch, is why is there the special exception for XML type in the
existing code, and how does that interact with this behavior? 
> !         /* ... exactly as-is for XML or encode is not required */
> !         if (type == XMLOID || !encode)
>               return str;

Seems like there could be cases where we're getting one too many or too
few encoding passes when the input is XML.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Feedback on writing extensible modules
Next
From: Andrew Dunstan
Date:
Subject: check for missing tablespaces?