Dumping a DB without pg_dump
Asked Answered
G

2

19

Is there any way to dump a postgres db using psql only ( without pg_dump )? Thanks.

Gingery answered 24/2, 2012 at 15:18 Comment(2)
Why would you want to do that?Jelena
If the system you have access to, say a locked down Docker container, only has an older version of pg_dump you may run into a Pg server version mismatchChelseachelsey
C
3

Theoretically you have access to all the data needed. In practice you're more likely to be able to dump/save some data using COPY command, but not the database schema, etc.

Note, that you do not have to have pg_dump on the same machine where your database server is, if it listens to the network. But well, I don't know why you even ask :)

Careerist answered 24/2, 2012 at 15:47 Comment(1)
well, it was mostly curiosity.Gingery
R
1

In theory you could run queries to extract the schema and then use those results to extract the data. But it wouldn't be easy to manipulate all of that into something usable for a restore using just psql.

Roughneck answered 24/2, 2012 at 15:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.