Re: XML schemas and PG column names

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: XML schemas and PG column names
Date: 2009-12-12 20:04:44
Message-ID: 4B23F75C.7030100@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:
> Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
>
>> Tom Lane wrote:
>>
>>> 2. What happens when the column name contains characters that would have
>>> to be escaped, such as "<" --- haven't you just replaced one de-escaping
>>> problem with another?
>>>
>
>
>> But the difference is that the XML processor will automatically unescape
>> this value (and re-escape it on output if necessary). The user won't
>> have to do anything (or shouldn't if their XML processor is worth
>> anything at all).
>>
>
> OK, so your argument is that this is a standard escaping rule and the
> one in the SQL standard is, um, not standard. I wonder why the SQL
> committee felt compelled to invent their own, then?
>
>
>

They are two different things. An XML-escaped text value is by no means
necessarily a legal XML tag name (e.g. an XML name can't have spaces).
Possibly what they really did wrong was to try to map SQL column names
to XML tags at all. It might have been better to do something like:

<column name="foo &amp; bar">some value</column>

instead of what we produce, which I assume is in the standard:

<foo_x0020__x0026__x0020_bar>somevalue</foo_x0020__x0026__x0020_bar>

which I think is just plain ugly. OTOH, then it would have been far
harder (maybe impossible) to create an XML schema for such a mechanism,
so I assume that's why they did it this way.

Anyway, It would be nice to have a way of providing the non-mangled
names - I think what I have suggested should meet the case.

cheers

andrew

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2009-12-12 20:19:54 Re: Winflex
Previous Message Stephen Frost 2009-12-12 19:30:48 Re: Adding support for SE-Linux security