pg-restore

will pg_restore overwrite the existing tables?

我是研究僧i 提交于 2019-12-05 00:07:56
Say I have two host servers s1 and s2. In both the servers i have a schema named n1, now i have made some changes to some of the tables present in schema n1 of s1. I want the same change to be done to schema n1 of server s2. what i am planning to do is to take a backup of the schema n1 of server s1 using pg_dump and restore in the server s2 using pg_restore. Now my question is ,since there is already the same schema n1 in the server s2 with the same set of tables. what the restore process will do? will it overwrite the existing tables or should i drop the existing schema of server s2 and

Dump and restore of PostgreSQL database with hstore comparison in view fails

穿精又带淫゛_ 提交于 2019-12-04 13:28:08
问题 I have a view which compares two hstore columns. When I dump and restore this database, the restore fails with the following error message: Importing /tmp/hstore_test_2014-05-12.backup... pg_restore: [archiver (db)] Error while PROCESSING TOC: pg_restore: [archiver (db)] Error from TOC entry 172; 1259 1358132 VIEW hstore_test_view xxxx pg_restore: [archiver (db)] could not execute query: ERROR: operator does not exist: public.hstore = public.hstore LINE 2: SELECT NULLIF(hstore_test_table

Getting “[archiver] unsupported version (1.13) in file header” when running pg_restore

北战南征 提交于 2019-12-03 01:23:30
问题 I just upgraded to postgres 10.2 on mac os which matches 10.2 on heroku. I'm trying to download a copy of the database and restore it locally. Before the upgrade the restore would work fine. I run pg_restore --verbose --clean --no-acl --no-owner -h localhost -d database_name backup.dump but I am getting this error: pg_restore: [archiver] unsupported version (1.13) in file header The database appears to be working OK. It's a rails app and I upgraded the pg gems. I can run rake db:create and db

How do I convert a binary pgdump (compressed) to a plain SQL file?

馋奶兔 提交于 2019-12-02 21:44:44
I do want to search for some data inside a database dump but these dumps are using the binary-compressed format ( PGDMP header). How can I convert these to SQL without restoring them? Craig Ringer pg_restore , when run without a database name, outputs a text dump to stdout; you can send that elsewhere with -f or with I/O redirection. pg_restore -f mydatabase.sql mydatabase.dump The fastest method that I've used was: pg_restore mybinaryfile.backup > mysqlfile.sql No special flags, since pg_restore just spits it out to stdout. Note that if you run multiple clusters, the restore command may not

Restoring from Postgres sql file

百般思念 提交于 2019-12-02 16:46:19
问题 I have a backup from PostgresSQL database created this way: /usr/bin/pg_dump --no-owner --no-acl > dump.sql When I try to restore on a different machine: psql db < dump.sql it trows many errors: invalid command \N When I try to use pg_restore : pg_restore dump.sql -d db Different error: pg_restore: [archiver] input file appears to be a text format dump. Please use psql. According to documentation this should be a non issue. Any way to tell psql that \N character is a null value? 回答1: Oh hi me

Getting “[archiver] unsupported version (1.13) in file header” when running pg_restore

守給你的承諾、 提交于 2019-12-02 14:45:51
I just upgraded to postgres 10.2 on mac os which matches 10.2 on heroku. I'm trying to download a copy of the database and restore it locally. Before the upgrade the restore would work fine. I run pg_restore --verbose --clean --no-acl --no-owner -h localhost -d database_name backup.dump but I am getting this error: pg_restore: [archiver] unsupported version (1.13) in file header The database appears to be working OK. It's a rails app and I upgraded the pg gems. I can run rake db:create and db:migrate just fine. jumichot You need to upgrade your local postgres to get the last security patch

Using pg_dump and pg_restore correctly

偶尔善良 提交于 2019-12-01 23:25:10
So I regularly backup and restore databases and schema's using pgadmin4. I would like to do it with a batch file using commands as pg_dump and pg_restore. I however always fail to succeed in this and could use some help. The way I try to dump one schema (with data) is the following: pg_dump -U postgres -F c -d database -n schema > mw2 Then I try to restore it with pg_restore: pg_restore -U postgres -d otherdatabase -n schema mw2 First I tried to use .dump in stead of tar but the result stays the same; which is an empty schema in my database. Or the following error message: pg_restore:

Unable to restore psql database from pg_dump with a different username

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-01 18:38:30
I need to dump a postgres database from computer1 with postgres username1 and then restore it on computer2 with postgres username2. I keep running into the error that looks like the backup file wants to use username1: When I run this on computer2: psql dbname < backupname.pgsql I get this error: ERROR: role "username1" does not exist I have tried: // Dumping from computer1: pg_dump dbname > backupname.sql pg_dump dbname > backupname.pgsql pg_dump -U username1 dbname -N topology -T spacial_ref_sys > backupname.pgsql // Restoring on computer2: psql dbname < backupname.pgsql Is it the dumping or

Error in creating SEQUENCEs when restoring the PostgreSQL database

孤者浪人 提交于 2019-12-01 03:28:12
UserX has following grants: CREATE ROLE "UserX" LOGIN PASSWORD 'pass'; CREATE DATABASE "DBX" WITH OWNER="UserX" ENCODING='UTF8' TABLESPACE=pg_default CONNECTION LIMIT=-1; GRANT CONNECT ON DATABASE "DBX" TO "UserX"; GRANT USAGE ON SCHEMA public TO "UserX"; GRANT SELECT,INSERT,UPDATE,DELETE ON ALL TABLES IN SCHEMA public TO "UserX"; ALTER DEFAULT PRIVILEGES GRANT ALL ON TABLES TO "UserX"; ALTER DEFAULT PRIVILEGES GRANT ALL ON SEQUENCES TO "UserX"; I get following errors when trying to restore its dump to other database: pg_restore: creating SEQUENCE "public.tblX_Id_seq" pg_restore: [archiver (db

Error in creating SEQUENCEs when restoring the PostgreSQL database

感情迁移 提交于 2019-11-30 23:55:03
问题 UserX has following grants: CREATE ROLE "UserX" LOGIN PASSWORD 'pass'; CREATE DATABASE "DBX" WITH OWNER="UserX" ENCODING='UTF8' TABLESPACE=pg_default CONNECTION LIMIT=-1; GRANT CONNECT ON DATABASE "DBX" TO "UserX"; GRANT USAGE ON SCHEMA public TO "UserX"; GRANT SELECT,INSERT,UPDATE,DELETE ON ALL TABLES IN SCHEMA public TO "UserX"; ALTER DEFAULT PRIVILEGES GRANT ALL ON TABLES TO "UserX"; ALTER DEFAULT PRIVILEGES GRANT ALL ON SEQUENCES TO "UserX"; I get following errors when trying to restore