I hear that createdb is better to run against live a database instead of pg_restore.. I have this command:
PGPASSWORD="$db_pwd" createdb -U "$db_user" -h "$db_host" -p 5432 --no-password -e "$db_name"
but I am getting this error:
SELECT pg_catalog.set_config('search_path', '', false)
CREATE DATABASE platform_production_backup_2;
pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 4034; 0 0 COMMENT EXTENSION pg_trgm
pg_restore: [archiver (db)] could not execute query: ERROR: must be owner of extension pg_trgm
Command was: COMMENT ON EXTENSION pg_trgm IS 'text similarity measurement and index searching based on trigrams';
so what does this error mean:
ERROR: must be owner of extension pg_trgm
? why is it trying to use the extension or copy it?
That error is harmless.
It means that you restored the dump as a user that is not a superuser, so you cannot set the comment on the (already existing) extension pg_trgm.
I have a postgres db for my backend hosted in Heroku. I am changing vps now to a different vendor altogether.
I used following commands:
heroku pg:backups:capture
heroku pg:backups:download
to take dump file, and than ran the following comamnd to pg_restore to remote vps postgres (I have ssh to remote server):
pg_restore --verbose --clean --no-acl -h localhost -p 5444 -d databasename -U databaseuser latest.dump --no-owner -x
I get the following message/errors:
pg_restore: creating INDEX "public.partners_address_e9624195"
pg_restore: [archiver (db)] Error from TOC entry 5465; 1259 6124214 INDEX partners_address_e9624195 vumqvdyhbbakqw
pg_restore: [archiver (db)] could not execute query: ERROR: relation "public.partners_address" does not exist
Command was: CREATE INDEX "partners_address_e9624195" ON "public"."partners_address" USING "btree" ("businesses_id");
pg_restore: creating INDEX "public.partners_address_latitude_38918148755fccdf_uniq"
pg_restore: [archiver (db)] Error from TOC entry 5466; 1259 6124984 INDEX partners_address_latitude_38918148755fccdf_uniq vumqvdyhbbakqw
pg_restore: [archiver (db)] could not execute query: ERROR: relation "public.partners_address" does not exist
Command was: CREATE INDEX "partners_address_latitude_38918148755fccdf_uniq" ON "public"."partners_address" USING "btree" ("latitude");
pg_restore: creating INDEX "public.partners_address_location_id"
pg_restore: [archiver (db)] Error from TOC entry 5467; 1259 6124734 INDEX partners_address_location_id vumqvdyhbbakqw
pg_restore: [archiver (db)] could not execute query: ERROR: relation "public.partners_address" does not exist
Command was: CREATE INDEX "partners_address_location_id" ON "public"."partners_address" USING "gist" ("location");
pg_restore: creating INDEX "public.partners_address_longitude_6a1bd0c5aaf227a5_uniq"
pg_restore: [archiver (db)] Error from TOC entry 5468; 1259 6124985 INDEX partners_address_longitude_6a1bd0c5aaf227a5_uniq vumqvdyhbbakqw
pg_restore: [archiver (db)] could not execute query: ERROR: relation "public.partners_address" does not exist
Command was: CREATE INDEX "partners_address_longitude_6a1bd0c5aaf227a5_uniq" ON "public"."partners_address" USING "btree" ("longitude");
pg_restore: creating INDEX "public.partners_addressdummy_location_id"
pg_restore: [archiver (db)] Error from TOC entry 5484; 1259 6124296 INDEX partners_addressdummy_location_id vumqvdyhbbakqw
pg_restore: [archiver (db)] could not execute query: ERROR: relation "public.partners_addressdummy" does not exist
Command was: CREATE INDEX "partners_addressdummy_location_id" ON "public"."partners_addressdummy" USING "gist" ("location");
pg_restore: creating FK CONSTRAINT "public.partners_company partners_com_partner_id_68062c1b87fe6c02_fk_partners_partner_id"
pg_restore: creating FK CONSTRAINT "public.partners_companybankinginformation partners_comp_company_id_a85698afe499099_fk_partners_company_id"
pg_restore: creating FK CONSTRAINT "public.partners_fitnessinstantflooroffer partners_fi_business_id_db86587ff737cea_fk_partners_business_id"
pg_restore: creating FK CONSTRAINT "public.partners_partneraddons partners_par_addon_id_9f51a49f7df191c_fk_partners_addonmodel_id"
pg_restore: creating FK CONSTRAINT "public.partners_partneraddons partners_par_partner_id_409ed0f55743b48e_fk_partners_partner_id"
pg_restore: creating FK CONSTRAINT "public.partners_partner partners_partner_user_id_ca28b796442d283_fk_auth_user_id"
pg_restore: creating FK CONSTRAINT "public.partners_salonmenu partners_s_business_id_2e0ca679b0a24854_fk_partners_business_id"
pg_restore: creating FK CONSTRAINT "public.partners_sixdigitcode partners_s_business_id_345f911c3107973d_fk_partners_business_id"
pg_restore: creating FK CONSTRAINT "public.partners_trackbusinessdetails partners_t_business_id_1eb5c6794f6b1ada_fk_partners_business_id"
pg_restore: creating FK CONSTRAINT "public.recurrence_date recu_recurrence_id_4b67510aee5dda10_fk_recurrence_recurrence_id"
pg_restore: creating FK CONSTRAINT "public.recurrence_rule recu_recurrence_id_7ff1cb1803879eea_fk_recurrence_recurrence_id"
pg_restore: creating FK CONSTRAINT "public.recurrence_param recurrence_param_rule_id_5163400228e5d6ac_fk_recurrence_rule_id"
pg_restore: creating FK CONSTRAINT "public.social_auth_usersocialauth social_auth_usersocial_user_id_5af7eafade59e216_fk_auth_user_id"
WARNING: errors ignored on restore: 335
This operation was performed on an empty database. What am I doing wrong?
Help please!
Thanks
Dump Commond:
pg_dump -Fc test > /home/backup/test4.sql.gz
Restore Commond:
bash-4.1$ pg_restore -d test /home/backup/test4.sql.gz
pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 2408; 0 666136 TABLE DATA pat postgres
pg_restore: [archiver (db)] COPY failed for table "pat": ERROR: pattern_in is not implemented
CONTEXT: COPY pat, line 1, column ptn: "((0.244171, 0.008272, 0.021515, -0.012174, 0.068765, 0.076409, 0.016820, 0.021921, 0.114738, 0.12366..."
pg_restore: [archiver (db)] Error from TOC entry 2445; 0 4877471 TABLE DATA pat_303816 postgres
pg_restore: [archiver (db)] COPY failed for table "pat_303816": ERROR: pattern_in is not implemented
CONTEXT: COPY pat_303816, line 1, column ptn: "((0.446228, -0.151998, -0.054444, -0.095391, 0.027121, 0.028324, 0.017388, 0.133117, 0.008461, 0.012..."
pg_restore: [archiver (db)] Error from TOC entry 2441; 0 4800536 TABLE DATA pat_402653 postgres
pg_restore: [archiver (db)] COPY failed for table "pat_402653": ERROR: pattern_in is not implemented
CONTEXT: COPY pat_402653, line 1, column ptn: "((0.505515, 0.040819, 0.057495, 0.044649, 0.065036, 0.021012, 0.006341, 0.045162, 0.061616, 0.085675..."
pg_restore: [archiver (db)] Error from TOC entry 2449; 0 4878143 TABLE DATA pat_452238 postgres
pg_restore: [archiver (db)] COPY failed for table "pat_452238": ERROR: pattern_in is not implemented
CONTEXT: COPY pat_452238, line 1, column ptn: "((0.124739, -0.015536, 0.045421, 0.013990, 0.000782, 0.013343, 0.018824, 0.002218, 0.009941, 0.01699..."
WARNING: errors ignored on restore: 4
If I'm not mistaken, one of your views is referencing a function called pattern_in.
You're missing an extension in your database. You'll need to run CREATE EXTENSION foo after creating the database, but before restoring your database from backup. Where foo is the name of the extension that provides the pattern_in function; I think it could be this one.
I'm trying to restore a table in a db in postgres from a .sql file.
I used command pg_restore -d dbName file.sql. The user is a superuser. But I got several errors:
pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 359; 1259 499945 TABLE fuller4t7 someName
pg_restore: [archiver (db)] could not execute query: ERROR: permission denied to create "pg_catalog.fuller4t7"
DETAIL: System catalog modifications are currently disallowed.
Command was: CREATE TABLE fuller4t7 (
gid integer NOT NULL,
geom public.geometry(MultiPolygon,4326)
);
Other errors are related with this one since the table was not created in the first place. I'm wondering what these errors mean. I'm using postgres 9.4 and I have PostGIS extensions added to the particular database.
When restoring a dump like this:
pg_restore --clean --create --exit-on-error --dbname=test test.tar
these error messages got printed out:
pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 21; 2615 80924 SCHEMA test test
pg_restore: [archiver (db)] could not execute query: ERROR: schema "test" already exists
Command was: CREATE SCHEMA test;
but when:
select schema_name from information_schema.schemata;
these got printed out
schema_name
--------------------
pg_toast
pg_temp_1
pg_toast_temp_1
pg_catalog
public
information_schema
It seems like schema "test" doesn't exist yet,why do I got this kind of error?
What OS, which version of postgres dump was made, restored to same version?
Read this article, maybe it will help.
It states that there are some trivial issues with the --clean parameter,
and you probably should try to create database manually and restore to it without
the create and clean options.