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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Itagaki Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>
Cc: pgsql-hackers(at)postgresql(dot)org, pgsql-bugs(at)postgresql(dot)org, Peter Eisentraut <peter_e(at)gmx(dot)net>
Subject: Re: [HACKERS] BUG #4822: xmlattributes encodes '&' twice
Date: 2009-05-31 17:00:44
Message-ID: 28781.1243789244@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

Itagaki Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message WarrenDLC 2009-05-31 22:15:01 failed to run initdb: 255!
Previous Message Euler Taveira de Oliveira 2009-05-29 15:56:43 Re: BUG #4830: operator does not exists

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2009-05-31 17:09:19 check for missing tablespaces?
Previous Message Tom Lane 2009-05-31 16:21:30 Re: Feedback on writing extensible modules