On 04/11/2013 11:48 PM, Andrew Dunstan wrote:
It could be interesting to have a library that would output database
metadata in some machine readable and manipulatable format such as
JSON or XML. One thing that's annoying about the text output pg_dump
produces is that it's not at all structured, so if you want, for
example, to restore a table but to a table of a different name, or to
a different schema, then you're reduced to having to mangle the SQL by
using hand editing or regular expression matching. Something with the
potential to ease that pain would be worth having.
Yes. This is really interesting. Current code in pg_dump, supports 4
ArchiveFormat, e.g. archCustom, archTar, archNull and archDirectory.
These formats are implementation of interface "pg_backup". Maybe I could
try to add two implementation of "XML" and "JSON".
It is worth to mention that I wrote a program to parse XML format
file into csv one using library "libxercesc" a month ago, Although, this
program is just like helloworld. But, maybe I could get benefit from
that small program, because both of them use XML format. And what I need
to do is try another xml library.
I had a look at JSON on wiki. The format is a little like XML. Both
of them are nested. And there are some library could be used, e.g.
libjson (or json.c, or other json library writting in C) and libxml2 (or
something else).
BTW, could it be an idea for GSOC? If so, I can have a try. Add XML
and JSON output format for pg_dump.
Thank you all for your attention.
Best regards,
Shuai
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers