pg_restore with -C option does not create the database

Exactly like @Eelke said – you’ve got in file wrote ‘create database’ so this database does not exist when you’re running script… That’s what for there is always ‘postgres’ database. Try this: pg_restore -C -d postgres -v -h xxhostxx -p 5432 -U xxuserxx test_pg_dump.dmp** And this should: connect to postgres database Create test database Disconnect … Read more

pg_restore toc error

this did the trick pg_dump database_name -c -Ft -f file_name.tar pg_restore -d database_name -c file_name.tar before this i was trying to restore with out including -c(clean) even though -c is included in pg_dump it is not used in pg_restore unless we say to use…

Is there a “pg_restore –quiet” option like “psql –quiet”?

The question seems to imply that pg_restore is executing these SQL commands and you wouldn’t want to see them in the output. But outputting them is what it’s only supposed to do. pg_restore has two modes of operation, with or without connecting to a database. When it’s called without a database (-d option) as shown … Read more

pg_restore: [archiver] unsupported version (1.14) in file header

ubuntu guys: most likely your pg_restore is outdated. Just use postgres doc and install newest version of postgres: Create the file /etc/apt/sources.list.d/pgdg.list and add a line for the repository: deb http://apt.postgresql.org/pub/repos/apt/ YOUR_UBUNTU_VERSION_HERE-pgdg main where ubuntu versions are: 20.04 – focal 18.04 – bionic 16.04 – xenial Add keys: wget –quiet -O – https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo … Read more

I want to restore the database with a different schema

A quick and dirty way: 1) rename default schema: alter schema public rename to public_save; 2) create new schema as default schema: create schema public; 3) restore data pg_restore -f pub.backup db_temp [and whatever other options] 4) rename schemas according to need: alter schema public rename to temp_schema; alter schema public_save rename to public;

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

You need to upgrade your local postgres to get the last security patch from the 2018-03-01, like Heroku did the 1st march. You need one of the last releases 10.3, 9.6.8, 9.5.12, 9.4.17, and 9.3.22. The security patch can be found here https://www.postgresql.org/about/news/1834/. It seems the patch modified pg_dump, that’s probably why we can’t use … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)