Re: XML ouput for psql - Mailing list pgsql-patches
From | Bruce Momjian |
---|---|
Subject | Re: XML ouput for psql |
Date | |
Msg-id | 200305241737.h4OHbEI12474@candle.pha.pa.us Whole thread Raw |
In response to | XML ouput for psql (greg@turnstep.com) |
Responses |
Re: XML ouput for psql
|
List | pgsql-patches |
I assume we are not moving in the XML/psql direction, right? We want it int he backend, or the psql HTML converted to XHTML? --------------------------------------------------------------------------- greg@turnstep.com wrote: [ There is text before PGP section. ] > [ PGP not available, raw data follows ] > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > > Patch to add XML output to psql: > > http://www.gtsm.com/xml.patch.txt > > Notes and questions: > > The basic output looks something like this: > > <?xml version="1.0" encoding="SQL_ASCII"?> > <resultset psql_version="7.4devel" query="select * from foo;"> > > <columns> > <col num="1">a</col> > <col num="2">b</col> > <col num="3">c</col> > <col num="4">mucho nacho </col> > </columns> > <row num="1"> > <a>1</a> > <b>pizza</b> > <c>2003-02-25 15:19:22.169797</c> > <"mucho nacho "></"mucho nacho "> > </row> > <row num="2"> > <a>2</a> > <b>mushroom</b> > <c>2003-02-25 15:19:26.969415</c> > <"mucho nacho "></"mucho nacho "> > </row> > <footer>(2 rows)</footer> > </resultset> > > and with the \x option: > > <?xml version="1.0" encoding="SQL_ASCII"?> > <resultset psql_version="7.4devel" query="select * from foo;"> > > <columns> > <col num="1">a</col> > <col num="2">b</col> > <col num="3">c</col> > <col num="4">mucho nacho </col> > </columns> > <row num="1"> > <cell name="a">1</cell> > <cell name="b">pizza</cell> > <cell name="c">2003-02-25 15:19:22.169797</cell> > <cell name="mucho nacho "></cell> > </row> > <row num="2"> > <cell name="a">2</cell> > <cell name="b">mushroom</cell> > <cell name="c">2003-02-25 15:19:26.969415</cell> > <cell name="mucho nacho "></cell> > </row> > </resultset> > > > The default encoding "SQL-ASCII" is not valid for XML. > Should it be automatically changed to something else? > > The flag "-X" is already taken, unfortunately, although \X is not. > I used "-L" and "\L" but they are not as memorable as "X". Anyone > see a way around this? Can we still use \X inside of psql? > > > It would be nice to include the string representation of the column > types in the xml output: > <col type="int8">foo</col> > ....but I could not find an easy way to do this: PQftype returns the > OID only (which is close but not quite there). Is there an > existing way to get the name of the type of a column from a > PQresult item? > > The HTML, XML, and Latex modes should have better documentation - > I'll submit a separate doc patch when/if this gets finalized. > > > - -- > Greg Sabino Mullane greg@turnstep.com > PGP Key: 0x14964AC8 200302261518 > > -----BEGIN PGP SIGNATURE----- > Comment: http://www.turnstep.com/pgp.html > > iD8DBQE+XSR/vJuQZxSWSsgRAi2jAJ9IAKnMBmNcVEEI8TXQBBd/rtm4XQCg0Vjq > IO9OsCSkdnNJqnrYYutM3jw= > =9kwY > -----END PGP SIGNATURE----- > > > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org > [ Decrypting message... End of raw data. ] -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073
pgsql-patches by date: