Re: XML ouput for psql

From: cbbrowne(at)cbbrowne(dot)com
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, greg(at)turnstep(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: XML ouput for psql
Date: 2003-03-06 02:10:33
Message-ID: 20030306021033.BDF3750595@cbbrowne.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

> Peter Eisentraut <peter_e(at)gmx(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2003-03-06 02:21:36 Re: [GENERAL] problems with dropped columns
Previous Message Tom Lane 2003-03-06 02:08:59 Re: [PATCHES] Non-colliding auto generated names

Browse pgsql-patches by date

  From Date Subject
Next Message Christopher Kings-Lynne 2003-03-06 02:27:03 Re: new format for describe (repost #2)
Previous Message Tom Lane 2003-03-06 02:08:59 Re: [PATCHES] Non-colliding auto generated names