1

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?

2 Answers 2

2

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

Sign up to request clarification or add additional context in comments.

Comments

0

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?

1 Comment

Have a look here: stackoverflow.com/questions/50276474/… looks like you need to add 'to' and the path location

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.