> Peter Eisentraut <peter_e@gmx.net> writes:
> > I also think that psql is not the place to implement something like this.
>
> Agreed.
>
> > It's most likely best put in the backend, as a function like
> > xmlfoo('select * from t1;')
> That seems a little bizarre. Wouldn't we want to have a switch that
> just flips the SELECT output format from one style to the other?
Ah, but this approach has the merit that it doesn't require pushing out
a completely new set of tools.
> This is also a good time to stop and ask whether the frontend/backend
> protocol needs to change to support this. Not having read the spec, I
> have no idea what the low-level transport needs are for XML output,
> but I suspect our present protocol is not it ...
That could be; there's enough variation in what one might want to do
with XML that it is not trivial to suggest an 'ideal' answer.
We have already seen the proposal of:
<record a="b" c="d" e="f">
<record a="c" c="e" e="g">
<record a="d" c="f" e="h">
<record a="e" c="g" e="i">
I would rather prefer something like:
<tablea><record> <a>b</a> <c>d</c> <e>f</e></record> <record> <a>c</a> <c>d</c> <e>f</e></record> <record>
<a>d</a><c>d</c> <e>f</e></record>
<tablea>
(Note that both approaches are quite rational possibilities.)
I'd think that the "protocol" would involve passing back a row-as-string
for each row in the result set.
--
output = ("cbbrowne" "@cbbrowne.com")
http://www.ntlug.org/~cbbrowne/xml.html
"There are two major products that come out of Berkeley: LSD and Unix.
We don't believe this to be a coincidence." - Jeremy S. Anderson