1.Open command prompt
2.Make it to point to bin in postgres folder
3.execute following command
pg_dump --column-inserts -U postgres databasename>filename
4. File will be stored in bin folder of postgres
How to generate script file of a database in postgresql with insert queries instead of copy query?
-
29-06-2022 - |
Frage
In postgresql, I had taken backup. That file didn't have any insert queries instead it used Some copy statments like
COPY user_customers (userid, customerlist) FROM stdin;
anil customer1:customer2
babu customer1:customer4
srikakulapu customer1:customer2
\.
But i want insert statements of that table....
How could I get the insert statements of table data in backup file?
Besides that I couldn't execute pg_dump
command....
I am generating backup file by right clicking on a table by chosing backup option..
Kindly help me out... Otherwise I have to rewrite all the insert queries manually for documentation....
waiting for your help.........
Lösung 2
Andere Tipps
If you use pg_dump , then you can add the -inserts
parameter.
Dump data as INSERT commands (rather than COPY).
If you could add the code of your attempt to use pg_dump, we could solve this problem, too.
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow