Re: XML ouput for psql

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: greg(at)turnstep(dot)com
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: XML ouput for psql
Date: 2003-05-24 17:37:14
Message-ID: 200305241737.h4OHbEI12474@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers 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(at)turnstep(dot)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(at)turnstep(dot)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(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Rod Taylor 2003-05-24 17:38:00 Re: Domain casting still not working right?
Previous Message PeterKorman 2003-05-24 15:58:59 UPDATE pg_language SET lanpltrusted=true WHERE lanname='plpgsql'

Browse pgsql-patches by date

  From Date Subject
Next Message Rod Taylor 2003-05-24 17:38:00 Re: Domain casting still not working right?
Previous Message Darko Prenosil 2003-05-24 17:33:07 Re: plpq for dblink