Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-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

pgsql-hackers by date

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

pgsql-patches by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group