Reputation: 343
I'd like to export whole PostgreSQL database to, preferably but not necessarily, a single XML file. I've found a lot of guides and solutions that help achieve the SQL>XML export, but for a single table. Is it possible, and if yes then how, to export whole database using PgAdmin or console command to XML format?
Upvotes: 1
Views: 8996
Reputation: 343
Thanks for help @Gholamali-Irani. It seems to do something for 2 minutes when I'm executing this query in PgAdmin, but where is the file stored? Can I specify the file name and path where it should be created? I've also found something about xPath function but I don't really understand the way it should be used or maybe I'm searching the solution in the wrong way?
Upvotes: 0
Reputation: 4350
In PostgreSQL you can do it like this:
SELECT database_to_xml(true, true, 'n');
see: https://www.postgresql.org/docs/current/static/functions-xml.html
Upvotes: 2