pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Sergiu Ignat <sergiu@bitsoftware.ro>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: XML element with special characters can be created, serialized, but not deserialized
Date: Tue, 16 May 2023 11:21:00 -0400
Message-ID: <2650678.1684250460@sss.pgh.pa.us> (raw)
In-Reply-To: <CAGtR-15ioG+_jPfZAX2b_YJnOJQSvB1u-sFrctTZ-gQnCZgitw@mail.gmail.com>
References: <CAGtR-15ioG+_jPfZAX2b_YJnOJQSvB1u-sFrctTZ-gQnCZgitw@mail.gmail.com>

Sergiu Ignat <sergiu@bitsoftware.ro> writes:
> I am using PostgreSQL 13.8 and I think that I found an issue with XML
> serialization and deserialization.

Hmm.  The root cause here seems to be that escape_xml() thinks it
doesn't need to escape ASCII control characters, other than CR (\r).
Which is a bit backwards, because after some googling I conclude that
XML 1.1 requires all C0 and C1 control characters to be represented as
numeric escapes *except* CR, LF, and TAB [1].

What we probably ought to do is escape all except LF and TAB.
However, I'm a bit hesitant to back-patch such a behavioral change.
Maybe change this in HEAD (v16) only?

			regards, tom lane

[1] https://www.w3.org/International/questions/qa-controls





view thread (2+ messages)

Message-ID: <2650678.1684250460@sss.pgh.pa.us>
Permalink:  ../2650678.1684250460@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/2650678.1684250460@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, sergiu@bitsoftware.ro, pgsql-bugs@lists.postgresql.org
  Subject: Re: XML element with special characters can be created, serialized, but not deserialized
  In-Reply-To: <2650678.1684250460@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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