Re: XML schemas and PG column names - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: XML schemas and PG column names
Date
Msg-id 4B23F75C.7030100@dunslane.net
Whole thread Raw
In response to Re: XML schemas and PG column names  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers

Tom Lane wrote:
> Andrew Dunstan <andrew@dunslane.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 & 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



pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: Adding support for SE-Linux security
Next
From: Andrew Dunstan
Date:
Subject: Re: Winflex