Re: [HACKERS] BUG #4822: xmlattributes encodes '&' twice

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: [HACKERS] BUG #4822: xmlattributes encodes '&' twice
Дата
Msg-id 200906100106.40912.peter_e@gmx.net
обсуждение исходный текст
Ответ на Re: [HACKERS] BUG #4822: xmlattributes encodes '&' twice  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
On Sunday 31 May 2009 20:00:44 Tom Lane wrote:
> 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?

This is so that
   xmlelement(name element, xml '<foo/>')

results in
   <element><foo/></element>

and
   xmlelement(name claim, text '1 < 2')

results in
   <claim>1 < 2</claim>

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

The patch doesn't actually change anything when the input datum is of type 
XML.  But anyway I have added a few regression test bits to make the 
expectations more explicit.


В списке pgsql-bugs по дате отправления:

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: [HACKERS] BUG #4822: xmlattributes encodes '&' twice
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #4838: Database corruption after btree_gin index creation