pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #14151: Xml special symbols are not unescaped when gettting value of Xml via xpath
3+ messages / 3 participants
[nested] [flat]
* BUG #14151: Xml special symbols are not unescaped when gettting value of Xml via xpath
@ 2016-05-19 15:00 onic@live.fr
0 siblings, 1 reply; 3+ messages in thread
From: onic@live.fr @ 2016-05-19 15:00 UTC (permalink / raw)
To: pgsql-bugs
The following bug has been logged on the website:
Bug reference: 14151
Logged by: oli nic
Email address: onic@live.fr
PostgreSQL version: 9.5.3
Operating system: Windows
Description:
The following bug has been logged on the website and the mailing list.
Bug reference: 7971.
It workds perfectly in 8.x but not in 9.5.
I've found this bug has already been discussed in 2 threads with no result
:
http://www.postgresql.org/message-id/BAY152-W51C845124155064D53F3CA8A8C0@phx.gbl
http://www.postgresql.org/message-id/E1UHyUw-0001oj-HE@wrigleys.postgresql.org
SELECT unnest(xpath('/name/text()', xmlelement(name name, 'AT&T', null )))
This gives me 'AT&T' and
I have NO WAY inside pgsql to get 'At&t' value
Is there any status/progress about this bug?
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #14151: Xml special symbols are not unescaped when gettting value of Xml via xpath
@ 2016-05-19 17:56 Tom Lane <tgl@sss.pgh.pa.us>
parent: onic@live.fr
0 siblings, 1 reply; 3+ messages in thread
From: Tom Lane @ 2016-05-19 17:56 UTC (permalink / raw)
To: onic@live.fr; +Cc: pgsql-bugs
onic@live.fr writes:
> SELECT unnest(xpath('/name/text()', xmlelement(name name, 'AT&T', null )))
> This gives me 'AT&T' and
AFAICS, that behavior is correct. xpath returns a value of type xml
(well, really xml[]) and 'AT&T' is not a legal value of that type;
only 'AT&T' is.
> I have NO WAY inside pgsql to get 'At&t' value
I agree that there ought to be an "unescape" function that would convert
this back to 'AT&T', but the lack of one seems like a missing feature not
a bug. I'd wonder for example what an unescape function ought to do with
other markup such as '<name>'.
The last concrete discussion we had on this seems to have been
this thread:
http://www.postgresql.org/message-id/flat/C71079E6-12D8-4048-B8C5-18368936FD5D@phlo.org
which petered out for lack of anyone finding the time to investigate
the relevant standards.
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: BUG #14151: Xml special symbols are not unescaped when gettting value of Xml via xpath
@ 2016-05-19 19:06 David G. Johnston <david.g.johnston@gmail.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 3+ messages in thread
From: David G. Johnston @ 2016-05-19 19:06 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs
On Thu, May 19, 2016 at 1:56 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> onic@live.fr writes:
> > SELECT unnest(xpath('/name/text()', xmlelement(name name, 'AT&T', null
> )))
> > This gives me 'AT&T' and
>
> AFAICS, that behavior is correct. xpath returns a value of type xml
> (well, really xml[]) and 'AT&T' is not a legal value of that type;
> only 'AT&T' is.
>
> > I have NO WAY inside pgsql to get 'At&t' value
>
> I agree that there ought to be an "unescape" function that would convert
> this back to 'AT&T', but the lack of one seems like a missing feature not
> a bug. I'd wonder for example what an unescape function ought to do with
> other markup such as '<name>'.
>
> The last concrete discussion we had on this seems to have been
> this thread:
>
>
> http://www.postgresql.org/message-id/flat/C71079E6-12D8-4048-B8C5-18368936FD5D@phlo.org
>
> which petered out for lack of anyone finding the time to investigate
> the relevant standards.
>
This
2013
thread further discusses our existing problematic behavior.
http://www.postgresql.org/message-id/flat/25508.1383590668@sss.pgh.pa.us#25508.1383590668@sss.pgh.pa...
I don't recall anything discussed in depth since then - just a bug report
or two from users.
http://www.postgresql.org/message-id/CALr6pkhSe20gh5Hci1H=uT_7QE4av0m9h2eQMjqUX6D6AD9H1Q@mail.gmail....
A basic entity decoder is fairly simply to write and doesn't require C code
- a single SQL function using replace will likely suffice.
The 2013 post I linked shows a potentially deeper consideration that we
need to take into account.
I'd challenge any community members who really want to see this get fixed
at least start things off by generating a set of queries and expected
outputs that can be commented upon and documented as being the desired
behavior with respect to both internal and external entities. At least
then we'd have clearly defined what the current and expected behaviors
are. With that in hand there is at least hope that someone less familiar
with xpath/xml generally, but familiar with PostgreSQL internals, would be
willing to take on the task of writing a patch that causes the tests to
pass. The existing test queries and resultant .out files should be
reasonably accessible even for someone not familiar with the code.
I'm inclined to think, however, that we will end up wanting an
"xpath_text(...)" function that returns text instead of xml. The
underlying problem here is that the xpath standard allows for different
kinds of outputs - which depend upon the xpath expression - while
PostgreSQL only allows for xml regardless of the underlying expression.
This dichotomy seems likely to be impossible to overcome without
introducing a new function.
Please, help us scratch your itch.
David J.
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2016-05-19 19:06 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-05-19 15:00 BUG #14151: Xml special symbols are not unescaped when gettting value of Xml via xpath onic@live.fr
2016-05-19 17:56 ` Tom Lane <tgl@sss.pgh.pa.us>
2016-05-19 19:06 ` David G. Johnston <david.g.johnston@gmail.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox