XML ouput for psql
От | greg@turnstep.com |
---|---|
Тема | XML ouput for psql |
Дата | |
Msg-id | b9daa33f80cc0a0c73d984696cb8fbac@biglumber.com обсуждение исходный текст |
Ответы |
Re: XML ouput for psql
(Hannu Krosing <hannu@tm.ee>)
Re: XML ouput for psql (Peter Eisentraut <peter_e@gmx.net>) Re: XML ouput for psql (Bruce Momjian <pgman@candle.pha.pa.us>) |
Список | pgsql-patches |
-----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-----
В списке pgsql-patches по дате отправления: