PG dump - error while restoring missing FROM-clause











up vote
-1
down vote

favorite












I dumped whole database with dictionary format while restoring to new database i get two errors:



pg_restore: [archiver (db)] could not execute query: ERROR:  missing FROM-clause entry for table "house_1"
LINE 85: ...tamp_3, modification_timestamp_3, district) ON (((house_1.ab...
^


and



relation "non_life_po.fo_search_po" does not exist


Why does it occur? Can PGadmin 4 restore whole database so it can be succesffuly restored or not?



From pgadmin4 in webbrowser i used backup to dictionary with pre-data, post-data and data.



I dumped also with command:



pg_dump -U postgres -h localhost --format=d --file=mydatabase.sqlc databaseName


Which also fails during restore.



The restore in PGadmin is executed with command (I checked that in logs):



C:Program Files (x86)pgAdmin 4v3runtimepg_restore.exe --host "localhost" --port "5432" --username "x_user" --no-password --dbname "db-test" --format=d --section=pre-data --section=data --section=post-data --jobs "4" --verbose "C:\BACKUP~1\ZLINUX~1\x-db\MYDATA~1.SQL\"


EDIT



I tried again with log_statement = 'all' option in config file on new DB and after 10877 seconds it failed.



The only errors where as following:



pg_restore: [archiver (db)] could not execute query: ERROR:  missing FROM-clause entry for table "house_1"
LINE 85: ...tamp_3, modification_timestamp_3, district) ON (((house_1.ab...
^
Command was: CREATE VIEW non_life.fo_search AS
SELECT p.policy_number,
p.renewal_type,
p.renewed_policy_number,
p.foreign_policy_number,
p.kind AS policy_kind,
nw.id,
nw.version_number,
nw.policy_purchase_date_time AS purchase_date_time,
(nw.policy_purchase_date_time)::date AS annex_date,
nw.policy_status,
nw.iban_number AS iban,
apv.sales_line_code,
apv.sales_package_code,
apv.total_premium_amount_currency AS total_amount_currency,
apv.requested_particularities,
apv.particularities,
apv.total_premium_amount AS total_amount,
(apv.policy_start_date_time)::date AS policy_start_date,
(apv.policy_end_date_time)::date AS policy_end_date,
apv.version_salesman_id AS salesman_id,
apv.version_agent_code AS agent_code,
pov.calculation_date AS calculation_date_time,
prod.code AS product_code,
pvar.code AS product_variant_code,
pvar.insurance_company_code AS insurance_company,
phdata.first_name AS registration_plate,
phdata.first_name AS policy_holder_first_name,
phdata.last_name AS policy_holder_last_name,
phdata.contact_phone AS policy_holder_phone_number,
phdata.email_address AS policy_holder_email,
phdata.pesel AS policy_holder_pesel,
phdata.company_name AS policy_holder_company,
phdata.regon AS policy_holder_regon,
phdata.person_type AS policy_holder_type,
adata.apartment_number,
adata.city,
adata.house_number,
adata.street,
adata.zip_code,
adata.country,
adata.district,
COALESCE(house_1.apartment_number) AS house_apartment_number,
COALESCE(house_1.city) AS house_city,
COALESCE(house_1.house_number) AS house_house_number,
COALESCE(house_1.street) AS house_street,
COALESCE(house_1.zip_code) AS house_zip_code,
COALESCE(house_1.country) AS house_country,
COALESCE(house_1.district) AS house_district,
NULL::text AS farm_apartment_number,
NULL::text AS farm_city,
NULL::text AS farm_house_number,
NULL::text AS farm_street,
NULL::text AS farm_zip_code,
NULL::text AS farm_country,
NULL::text AS farm_district,
COALESCE(travel.destination_area) AS destination_area
FROM ((((((((((((((((( SELECT apv_1.id,
pv.version_number,
pv.policy_id,
pv.policy_purchase_date_time,
pv.policy_status,
pv.iban_number,
row_number() OVER (PARTITION BY pv.policy_id ORDER BY pv.version_number DESC) AS rn
FROM (non_life.abstract_policy_version apv_1
JOIN non_life.policy_version pv ON ((pv.id = apv_1.id)))
WHERE ((apv_1.status)::text = 'ACTIVE'::text)) nw
JOIN non_life.policy p ON (((p.id = nw.policy_id) AND (nw.rn = 1))))
JOIN non_life.abstract_policy_version apv ON ((nw.id = apv.id)))
JOIN non_life.product_variant pvar ON ((pvar.id = apv.product_variant_id)))
JOIN non_life.product_version prod_ver ON ((prod_ver.id = pvar.product_version_id)))
JOIN non_life.product prod ON ((prod.id = prod_ver.product_id)))
JOIN non_life.policy_person_in_policy phperson ON ((phperson.abstract_policy_version_id = apv.id)))
JOIN non_life.policy_element_type phtype ON (((phtype.id = phperson.policy_person_type_id) AND ((phtype.code)::text = 'POLICY_HOLDER'::text))))
JOIN non_life.policy_object phobject ON ((phobject.id = phperson.policy_object_id)))
JOIN non_life.policy_person phpolicyperson ON ((phpolicyperson.id = phobject.id)))
JOIN non_life.person_data phdata ON ((phdata.id = phpolicyperson.person_data_id)))
JOIN non_life.address_data adata ON ((adata.id = phdata.residence_address_id)))
JOIN non_life.insurance_company inc ON ((prod.insurance_company_id = inc.id)))
JOIN non_life.policy_application papp ON ((papp.id = p.policy_application_id)))
JOIN non_life.offer_version pov ON ((pov.id = papp.offer_version_id)))
LEFT JOIN (((non_life.policy_object po_house
JOIN non_life.policy_house house ON ((house.id = po_house.id)))
JOIN non_life.house_data house_data ON ((house.house_data_id = house_data.id)))
JOIN non_life.address_data house_addr ON ((house_data.address_id = house_addr.id))) house(id, policy_object_id, abstract_policy_version_id, is_active, created_by, modified_by, creation_timestamp, modification_timestamp, new_state_value, calc_consumption, declared_consumption, calculated_value, declared_value, declared_value_type, id_1, house_data_id, created_by_1, modified_by_1, creation_timestamp_1, modification_timestamp_1, id_2, anti_theft_protection, construction_year, flat_location, flood_in_recent_years, flammable_construction_tech, number_of_claims_in_recent_years, usable_area, address_id, house_type, created_by_2, modified_by_2, creation_timestamp_2, modification_timestamp_2, id_3, apartment_number, city, house_number, street, zip_code, country, created_by_3, modified_by_3, creation_timestamp_3, modification_timestamp_3, district) ON (((house_1.abstract_policy_version_id = apv.id) AND ((prod.line_of_product)::text = 'HOUSE'::text))))
LEFT JOIN (non_life.policy_object po_travel
JOIN non_life.policy_tourists_group tg ON ((tg.id = po_travel.id))) travel(id, policy_object_id, abstract_policy_version_id, is_active, created_by, modified_by, creation_timestamp, modification_timestamp, new_state_value, calc_consumption, declared_consumption, calculated_value, declared_value, declared_value_type, id_1, destination_area, count_disease, count_labour_abroad, count_winter_sport, count_high_risk, all_in_home_country, number_of_cars, created_by_1, modified_by_1, creation_timestamp_1, modification_timestamp_1, purpose_of_visit, adult_count, children_count, oldage_count, event_purchase_date) ON (((travel.abstract_policy_version_id = apv.id) AND ((prod.line_of_product)::text = 'TRAVEL'::text))));



pg_restore: [archiver (db)] could not execute query: ERROR: relation "non_life.fo_search" does not exist
Command was: ALTER TABLE non_life.fo_search OWNER TO user;


pg_restore: processing item 1214 TABLE generic_object_data









share|improve this question
























  • What is the exact command line you used for pg_restore?
    – a_horse_with_no_name
    2 days ago










  • From pgadmin4 in webbrowser i used backup to dictionary with pre-data, post-data and data
    – yami
    2 days ago










  • I dumped also with command pg_dump -U postgres -h localhost --format=d --file=mydatabase.sqlc databaseName
    – yami
    2 days ago










  • @a_horse_with_no_name I added command for dump and the one for restore.
    – yami
    2 days ago






  • 1




    Sorry, the statement is SELECT pg_get_viewdef('non_life.fo_search'::regclass). It should be house_1 rather than house in this part of the query: LEFT JOIN (... JOIN ... JOIN ...JOIN ...) house(id, policy_object_id,....
    – Laurenz Albe
    yesterday















up vote
-1
down vote

favorite












I dumped whole database with dictionary format while restoring to new database i get two errors:



pg_restore: [archiver (db)] could not execute query: ERROR:  missing FROM-clause entry for table "house_1"
LINE 85: ...tamp_3, modification_timestamp_3, district) ON (((house_1.ab...
^


and



relation "non_life_po.fo_search_po" does not exist


Why does it occur? Can PGadmin 4 restore whole database so it can be succesffuly restored or not?



From pgadmin4 in webbrowser i used backup to dictionary with pre-data, post-data and data.



I dumped also with command:



pg_dump -U postgres -h localhost --format=d --file=mydatabase.sqlc databaseName


Which also fails during restore.



The restore in PGadmin is executed with command (I checked that in logs):



C:Program Files (x86)pgAdmin 4v3runtimepg_restore.exe --host "localhost" --port "5432" --username "x_user" --no-password --dbname "db-test" --format=d --section=pre-data --section=data --section=post-data --jobs "4" --verbose "C:\BACKUP~1\ZLINUX~1\x-db\MYDATA~1.SQL\"


EDIT



I tried again with log_statement = 'all' option in config file on new DB and after 10877 seconds it failed.



The only errors where as following:



pg_restore: [archiver (db)] could not execute query: ERROR:  missing FROM-clause entry for table "house_1"
LINE 85: ...tamp_3, modification_timestamp_3, district) ON (((house_1.ab...
^
Command was: CREATE VIEW non_life.fo_search AS
SELECT p.policy_number,
p.renewal_type,
p.renewed_policy_number,
p.foreign_policy_number,
p.kind AS policy_kind,
nw.id,
nw.version_number,
nw.policy_purchase_date_time AS purchase_date_time,
(nw.policy_purchase_date_time)::date AS annex_date,
nw.policy_status,
nw.iban_number AS iban,
apv.sales_line_code,
apv.sales_package_code,
apv.total_premium_amount_currency AS total_amount_currency,
apv.requested_particularities,
apv.particularities,
apv.total_premium_amount AS total_amount,
(apv.policy_start_date_time)::date AS policy_start_date,
(apv.policy_end_date_time)::date AS policy_end_date,
apv.version_salesman_id AS salesman_id,
apv.version_agent_code AS agent_code,
pov.calculation_date AS calculation_date_time,
prod.code AS product_code,
pvar.code AS product_variant_code,
pvar.insurance_company_code AS insurance_company,
phdata.first_name AS registration_plate,
phdata.first_name AS policy_holder_first_name,
phdata.last_name AS policy_holder_last_name,
phdata.contact_phone AS policy_holder_phone_number,
phdata.email_address AS policy_holder_email,
phdata.pesel AS policy_holder_pesel,
phdata.company_name AS policy_holder_company,
phdata.regon AS policy_holder_regon,
phdata.person_type AS policy_holder_type,
adata.apartment_number,
adata.city,
adata.house_number,
adata.street,
adata.zip_code,
adata.country,
adata.district,
COALESCE(house_1.apartment_number) AS house_apartment_number,
COALESCE(house_1.city) AS house_city,
COALESCE(house_1.house_number) AS house_house_number,
COALESCE(house_1.street) AS house_street,
COALESCE(house_1.zip_code) AS house_zip_code,
COALESCE(house_1.country) AS house_country,
COALESCE(house_1.district) AS house_district,
NULL::text AS farm_apartment_number,
NULL::text AS farm_city,
NULL::text AS farm_house_number,
NULL::text AS farm_street,
NULL::text AS farm_zip_code,
NULL::text AS farm_country,
NULL::text AS farm_district,
COALESCE(travel.destination_area) AS destination_area
FROM ((((((((((((((((( SELECT apv_1.id,
pv.version_number,
pv.policy_id,
pv.policy_purchase_date_time,
pv.policy_status,
pv.iban_number,
row_number() OVER (PARTITION BY pv.policy_id ORDER BY pv.version_number DESC) AS rn
FROM (non_life.abstract_policy_version apv_1
JOIN non_life.policy_version pv ON ((pv.id = apv_1.id)))
WHERE ((apv_1.status)::text = 'ACTIVE'::text)) nw
JOIN non_life.policy p ON (((p.id = nw.policy_id) AND (nw.rn = 1))))
JOIN non_life.abstract_policy_version apv ON ((nw.id = apv.id)))
JOIN non_life.product_variant pvar ON ((pvar.id = apv.product_variant_id)))
JOIN non_life.product_version prod_ver ON ((prod_ver.id = pvar.product_version_id)))
JOIN non_life.product prod ON ((prod.id = prod_ver.product_id)))
JOIN non_life.policy_person_in_policy phperson ON ((phperson.abstract_policy_version_id = apv.id)))
JOIN non_life.policy_element_type phtype ON (((phtype.id = phperson.policy_person_type_id) AND ((phtype.code)::text = 'POLICY_HOLDER'::text))))
JOIN non_life.policy_object phobject ON ((phobject.id = phperson.policy_object_id)))
JOIN non_life.policy_person phpolicyperson ON ((phpolicyperson.id = phobject.id)))
JOIN non_life.person_data phdata ON ((phdata.id = phpolicyperson.person_data_id)))
JOIN non_life.address_data adata ON ((adata.id = phdata.residence_address_id)))
JOIN non_life.insurance_company inc ON ((prod.insurance_company_id = inc.id)))
JOIN non_life.policy_application papp ON ((papp.id = p.policy_application_id)))
JOIN non_life.offer_version pov ON ((pov.id = papp.offer_version_id)))
LEFT JOIN (((non_life.policy_object po_house
JOIN non_life.policy_house house ON ((house.id = po_house.id)))
JOIN non_life.house_data house_data ON ((house.house_data_id = house_data.id)))
JOIN non_life.address_data house_addr ON ((house_data.address_id = house_addr.id))) house(id, policy_object_id, abstract_policy_version_id, is_active, created_by, modified_by, creation_timestamp, modification_timestamp, new_state_value, calc_consumption, declared_consumption, calculated_value, declared_value, declared_value_type, id_1, house_data_id, created_by_1, modified_by_1, creation_timestamp_1, modification_timestamp_1, id_2, anti_theft_protection, construction_year, flat_location, flood_in_recent_years, flammable_construction_tech, number_of_claims_in_recent_years, usable_area, address_id, house_type, created_by_2, modified_by_2, creation_timestamp_2, modification_timestamp_2, id_3, apartment_number, city, house_number, street, zip_code, country, created_by_3, modified_by_3, creation_timestamp_3, modification_timestamp_3, district) ON (((house_1.abstract_policy_version_id = apv.id) AND ((prod.line_of_product)::text = 'HOUSE'::text))))
LEFT JOIN (non_life.policy_object po_travel
JOIN non_life.policy_tourists_group tg ON ((tg.id = po_travel.id))) travel(id, policy_object_id, abstract_policy_version_id, is_active, created_by, modified_by, creation_timestamp, modification_timestamp, new_state_value, calc_consumption, declared_consumption, calculated_value, declared_value, declared_value_type, id_1, destination_area, count_disease, count_labour_abroad, count_winter_sport, count_high_risk, all_in_home_country, number_of_cars, created_by_1, modified_by_1, creation_timestamp_1, modification_timestamp_1, purpose_of_visit, adult_count, children_count, oldage_count, event_purchase_date) ON (((travel.abstract_policy_version_id = apv.id) AND ((prod.line_of_product)::text = 'TRAVEL'::text))));



pg_restore: [archiver (db)] could not execute query: ERROR: relation "non_life.fo_search" does not exist
Command was: ALTER TABLE non_life.fo_search OWNER TO user;


pg_restore: processing item 1214 TABLE generic_object_data









share|improve this question
























  • What is the exact command line you used for pg_restore?
    – a_horse_with_no_name
    2 days ago










  • From pgadmin4 in webbrowser i used backup to dictionary with pre-data, post-data and data
    – yami
    2 days ago










  • I dumped also with command pg_dump -U postgres -h localhost --format=d --file=mydatabase.sqlc databaseName
    – yami
    2 days ago










  • @a_horse_with_no_name I added command for dump and the one for restore.
    – yami
    2 days ago






  • 1




    Sorry, the statement is SELECT pg_get_viewdef('non_life.fo_search'::regclass). It should be house_1 rather than house in this part of the query: LEFT JOIN (... JOIN ... JOIN ...JOIN ...) house(id, policy_object_id,....
    – Laurenz Albe
    yesterday













up vote
-1
down vote

favorite









up vote
-1
down vote

favorite











I dumped whole database with dictionary format while restoring to new database i get two errors:



pg_restore: [archiver (db)] could not execute query: ERROR:  missing FROM-clause entry for table "house_1"
LINE 85: ...tamp_3, modification_timestamp_3, district) ON (((house_1.ab...
^


and



relation "non_life_po.fo_search_po" does not exist


Why does it occur? Can PGadmin 4 restore whole database so it can be succesffuly restored or not?



From pgadmin4 in webbrowser i used backup to dictionary with pre-data, post-data and data.



I dumped also with command:



pg_dump -U postgres -h localhost --format=d --file=mydatabase.sqlc databaseName


Which also fails during restore.



The restore in PGadmin is executed with command (I checked that in logs):



C:Program Files (x86)pgAdmin 4v3runtimepg_restore.exe --host "localhost" --port "5432" --username "x_user" --no-password --dbname "db-test" --format=d --section=pre-data --section=data --section=post-data --jobs "4" --verbose "C:\BACKUP~1\ZLINUX~1\x-db\MYDATA~1.SQL\"


EDIT



I tried again with log_statement = 'all' option in config file on new DB and after 10877 seconds it failed.



The only errors where as following:



pg_restore: [archiver (db)] could not execute query: ERROR:  missing FROM-clause entry for table "house_1"
LINE 85: ...tamp_3, modification_timestamp_3, district) ON (((house_1.ab...
^
Command was: CREATE VIEW non_life.fo_search AS
SELECT p.policy_number,
p.renewal_type,
p.renewed_policy_number,
p.foreign_policy_number,
p.kind AS policy_kind,
nw.id,
nw.version_number,
nw.policy_purchase_date_time AS purchase_date_time,
(nw.policy_purchase_date_time)::date AS annex_date,
nw.policy_status,
nw.iban_number AS iban,
apv.sales_line_code,
apv.sales_package_code,
apv.total_premium_amount_currency AS total_amount_currency,
apv.requested_particularities,
apv.particularities,
apv.total_premium_amount AS total_amount,
(apv.policy_start_date_time)::date AS policy_start_date,
(apv.policy_end_date_time)::date AS policy_end_date,
apv.version_salesman_id AS salesman_id,
apv.version_agent_code AS agent_code,
pov.calculation_date AS calculation_date_time,
prod.code AS product_code,
pvar.code AS product_variant_code,
pvar.insurance_company_code AS insurance_company,
phdata.first_name AS registration_plate,
phdata.first_name AS policy_holder_first_name,
phdata.last_name AS policy_holder_last_name,
phdata.contact_phone AS policy_holder_phone_number,
phdata.email_address AS policy_holder_email,
phdata.pesel AS policy_holder_pesel,
phdata.company_name AS policy_holder_company,
phdata.regon AS policy_holder_regon,
phdata.person_type AS policy_holder_type,
adata.apartment_number,
adata.city,
adata.house_number,
adata.street,
adata.zip_code,
adata.country,
adata.district,
COALESCE(house_1.apartment_number) AS house_apartment_number,
COALESCE(house_1.city) AS house_city,
COALESCE(house_1.house_number) AS house_house_number,
COALESCE(house_1.street) AS house_street,
COALESCE(house_1.zip_code) AS house_zip_code,
COALESCE(house_1.country) AS house_country,
COALESCE(house_1.district) AS house_district,
NULL::text AS farm_apartment_number,
NULL::text AS farm_city,
NULL::text AS farm_house_number,
NULL::text AS farm_street,
NULL::text AS farm_zip_code,
NULL::text AS farm_country,
NULL::text AS farm_district,
COALESCE(travel.destination_area) AS destination_area
FROM ((((((((((((((((( SELECT apv_1.id,
pv.version_number,
pv.policy_id,
pv.policy_purchase_date_time,
pv.policy_status,
pv.iban_number,
row_number() OVER (PARTITION BY pv.policy_id ORDER BY pv.version_number DESC) AS rn
FROM (non_life.abstract_policy_version apv_1
JOIN non_life.policy_version pv ON ((pv.id = apv_1.id)))
WHERE ((apv_1.status)::text = 'ACTIVE'::text)) nw
JOIN non_life.policy p ON (((p.id = nw.policy_id) AND (nw.rn = 1))))
JOIN non_life.abstract_policy_version apv ON ((nw.id = apv.id)))
JOIN non_life.product_variant pvar ON ((pvar.id = apv.product_variant_id)))
JOIN non_life.product_version prod_ver ON ((prod_ver.id = pvar.product_version_id)))
JOIN non_life.product prod ON ((prod.id = prod_ver.product_id)))
JOIN non_life.policy_person_in_policy phperson ON ((phperson.abstract_policy_version_id = apv.id)))
JOIN non_life.policy_element_type phtype ON (((phtype.id = phperson.policy_person_type_id) AND ((phtype.code)::text = 'POLICY_HOLDER'::text))))
JOIN non_life.policy_object phobject ON ((phobject.id = phperson.policy_object_id)))
JOIN non_life.policy_person phpolicyperson ON ((phpolicyperson.id = phobject.id)))
JOIN non_life.person_data phdata ON ((phdata.id = phpolicyperson.person_data_id)))
JOIN non_life.address_data adata ON ((adata.id = phdata.residence_address_id)))
JOIN non_life.insurance_company inc ON ((prod.insurance_company_id = inc.id)))
JOIN non_life.policy_application papp ON ((papp.id = p.policy_application_id)))
JOIN non_life.offer_version pov ON ((pov.id = papp.offer_version_id)))
LEFT JOIN (((non_life.policy_object po_house
JOIN non_life.policy_house house ON ((house.id = po_house.id)))
JOIN non_life.house_data house_data ON ((house.house_data_id = house_data.id)))
JOIN non_life.address_data house_addr ON ((house_data.address_id = house_addr.id))) house(id, policy_object_id, abstract_policy_version_id, is_active, created_by, modified_by, creation_timestamp, modification_timestamp, new_state_value, calc_consumption, declared_consumption, calculated_value, declared_value, declared_value_type, id_1, house_data_id, created_by_1, modified_by_1, creation_timestamp_1, modification_timestamp_1, id_2, anti_theft_protection, construction_year, flat_location, flood_in_recent_years, flammable_construction_tech, number_of_claims_in_recent_years, usable_area, address_id, house_type, created_by_2, modified_by_2, creation_timestamp_2, modification_timestamp_2, id_3, apartment_number, city, house_number, street, zip_code, country, created_by_3, modified_by_3, creation_timestamp_3, modification_timestamp_3, district) ON (((house_1.abstract_policy_version_id = apv.id) AND ((prod.line_of_product)::text = 'HOUSE'::text))))
LEFT JOIN (non_life.policy_object po_travel
JOIN non_life.policy_tourists_group tg ON ((tg.id = po_travel.id))) travel(id, policy_object_id, abstract_policy_version_id, is_active, created_by, modified_by, creation_timestamp, modification_timestamp, new_state_value, calc_consumption, declared_consumption, calculated_value, declared_value, declared_value_type, id_1, destination_area, count_disease, count_labour_abroad, count_winter_sport, count_high_risk, all_in_home_country, number_of_cars, created_by_1, modified_by_1, creation_timestamp_1, modification_timestamp_1, purpose_of_visit, adult_count, children_count, oldage_count, event_purchase_date) ON (((travel.abstract_policy_version_id = apv.id) AND ((prod.line_of_product)::text = 'TRAVEL'::text))));



pg_restore: [archiver (db)] could not execute query: ERROR: relation "non_life.fo_search" does not exist
Command was: ALTER TABLE non_life.fo_search OWNER TO user;


pg_restore: processing item 1214 TABLE generic_object_data









share|improve this question















I dumped whole database with dictionary format while restoring to new database i get two errors:



pg_restore: [archiver (db)] could not execute query: ERROR:  missing FROM-clause entry for table "house_1"
LINE 85: ...tamp_3, modification_timestamp_3, district) ON (((house_1.ab...
^


and



relation "non_life_po.fo_search_po" does not exist


Why does it occur? Can PGadmin 4 restore whole database so it can be succesffuly restored or not?



From pgadmin4 in webbrowser i used backup to dictionary with pre-data, post-data and data.



I dumped also with command:



pg_dump -U postgres -h localhost --format=d --file=mydatabase.sqlc databaseName


Which also fails during restore.



The restore in PGadmin is executed with command (I checked that in logs):



C:Program Files (x86)pgAdmin 4v3runtimepg_restore.exe --host "localhost" --port "5432" --username "x_user" --no-password --dbname "db-test" --format=d --section=pre-data --section=data --section=post-data --jobs "4" --verbose "C:\BACKUP~1\ZLINUX~1\x-db\MYDATA~1.SQL\"


EDIT



I tried again with log_statement = 'all' option in config file on new DB and after 10877 seconds it failed.



The only errors where as following:



pg_restore: [archiver (db)] could not execute query: ERROR:  missing FROM-clause entry for table "house_1"
LINE 85: ...tamp_3, modification_timestamp_3, district) ON (((house_1.ab...
^
Command was: CREATE VIEW non_life.fo_search AS
SELECT p.policy_number,
p.renewal_type,
p.renewed_policy_number,
p.foreign_policy_number,
p.kind AS policy_kind,
nw.id,
nw.version_number,
nw.policy_purchase_date_time AS purchase_date_time,
(nw.policy_purchase_date_time)::date AS annex_date,
nw.policy_status,
nw.iban_number AS iban,
apv.sales_line_code,
apv.sales_package_code,
apv.total_premium_amount_currency AS total_amount_currency,
apv.requested_particularities,
apv.particularities,
apv.total_premium_amount AS total_amount,
(apv.policy_start_date_time)::date AS policy_start_date,
(apv.policy_end_date_time)::date AS policy_end_date,
apv.version_salesman_id AS salesman_id,
apv.version_agent_code AS agent_code,
pov.calculation_date AS calculation_date_time,
prod.code AS product_code,
pvar.code AS product_variant_code,
pvar.insurance_company_code AS insurance_company,
phdata.first_name AS registration_plate,
phdata.first_name AS policy_holder_first_name,
phdata.last_name AS policy_holder_last_name,
phdata.contact_phone AS policy_holder_phone_number,
phdata.email_address AS policy_holder_email,
phdata.pesel AS policy_holder_pesel,
phdata.company_name AS policy_holder_company,
phdata.regon AS policy_holder_regon,
phdata.person_type AS policy_holder_type,
adata.apartment_number,
adata.city,
adata.house_number,
adata.street,
adata.zip_code,
adata.country,
adata.district,
COALESCE(house_1.apartment_number) AS house_apartment_number,
COALESCE(house_1.city) AS house_city,
COALESCE(house_1.house_number) AS house_house_number,
COALESCE(house_1.street) AS house_street,
COALESCE(house_1.zip_code) AS house_zip_code,
COALESCE(house_1.country) AS house_country,
COALESCE(house_1.district) AS house_district,
NULL::text AS farm_apartment_number,
NULL::text AS farm_city,
NULL::text AS farm_house_number,
NULL::text AS farm_street,
NULL::text AS farm_zip_code,
NULL::text AS farm_country,
NULL::text AS farm_district,
COALESCE(travel.destination_area) AS destination_area
FROM ((((((((((((((((( SELECT apv_1.id,
pv.version_number,
pv.policy_id,
pv.policy_purchase_date_time,
pv.policy_status,
pv.iban_number,
row_number() OVER (PARTITION BY pv.policy_id ORDER BY pv.version_number DESC) AS rn
FROM (non_life.abstract_policy_version apv_1
JOIN non_life.policy_version pv ON ((pv.id = apv_1.id)))
WHERE ((apv_1.status)::text = 'ACTIVE'::text)) nw
JOIN non_life.policy p ON (((p.id = nw.policy_id) AND (nw.rn = 1))))
JOIN non_life.abstract_policy_version apv ON ((nw.id = apv.id)))
JOIN non_life.product_variant pvar ON ((pvar.id = apv.product_variant_id)))
JOIN non_life.product_version prod_ver ON ((prod_ver.id = pvar.product_version_id)))
JOIN non_life.product prod ON ((prod.id = prod_ver.product_id)))
JOIN non_life.policy_person_in_policy phperson ON ((phperson.abstract_policy_version_id = apv.id)))
JOIN non_life.policy_element_type phtype ON (((phtype.id = phperson.policy_person_type_id) AND ((phtype.code)::text = 'POLICY_HOLDER'::text))))
JOIN non_life.policy_object phobject ON ((phobject.id = phperson.policy_object_id)))
JOIN non_life.policy_person phpolicyperson ON ((phpolicyperson.id = phobject.id)))
JOIN non_life.person_data phdata ON ((phdata.id = phpolicyperson.person_data_id)))
JOIN non_life.address_data adata ON ((adata.id = phdata.residence_address_id)))
JOIN non_life.insurance_company inc ON ((prod.insurance_company_id = inc.id)))
JOIN non_life.policy_application papp ON ((papp.id = p.policy_application_id)))
JOIN non_life.offer_version pov ON ((pov.id = papp.offer_version_id)))
LEFT JOIN (((non_life.policy_object po_house
JOIN non_life.policy_house house ON ((house.id = po_house.id)))
JOIN non_life.house_data house_data ON ((house.house_data_id = house_data.id)))
JOIN non_life.address_data house_addr ON ((house_data.address_id = house_addr.id))) house(id, policy_object_id, abstract_policy_version_id, is_active, created_by, modified_by, creation_timestamp, modification_timestamp, new_state_value, calc_consumption, declared_consumption, calculated_value, declared_value, declared_value_type, id_1, house_data_id, created_by_1, modified_by_1, creation_timestamp_1, modification_timestamp_1, id_2, anti_theft_protection, construction_year, flat_location, flood_in_recent_years, flammable_construction_tech, number_of_claims_in_recent_years, usable_area, address_id, house_type, created_by_2, modified_by_2, creation_timestamp_2, modification_timestamp_2, id_3, apartment_number, city, house_number, street, zip_code, country, created_by_3, modified_by_3, creation_timestamp_3, modification_timestamp_3, district) ON (((house_1.abstract_policy_version_id = apv.id) AND ((prod.line_of_product)::text = 'HOUSE'::text))))
LEFT JOIN (non_life.policy_object po_travel
JOIN non_life.policy_tourists_group tg ON ((tg.id = po_travel.id))) travel(id, policy_object_id, abstract_policy_version_id, is_active, created_by, modified_by, creation_timestamp, modification_timestamp, new_state_value, calc_consumption, declared_consumption, calculated_value, declared_value, declared_value_type, id_1, destination_area, count_disease, count_labour_abroad, count_winter_sport, count_high_risk, all_in_home_country, number_of_cars, created_by_1, modified_by_1, creation_timestamp_1, modification_timestamp_1, purpose_of_visit, adult_count, children_count, oldage_count, event_purchase_date) ON (((travel.abstract_policy_version_id = apv.id) AND ((prod.line_of_product)::text = 'TRAVEL'::text))));



pg_restore: [archiver (db)] could not execute query: ERROR: relation "non_life.fo_search" does not exist
Command was: ALTER TABLE non_life.fo_search OWNER TO user;


pg_restore: processing item 1214 TABLE generic_object_data






windows postgresql pgadmin-4 pg-restore






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited yesterday

























asked 2 days ago









yami

107118




107118












  • What is the exact command line you used for pg_restore?
    – a_horse_with_no_name
    2 days ago










  • From pgadmin4 in webbrowser i used backup to dictionary with pre-data, post-data and data
    – yami
    2 days ago










  • I dumped also with command pg_dump -U postgres -h localhost --format=d --file=mydatabase.sqlc databaseName
    – yami
    2 days ago










  • @a_horse_with_no_name I added command for dump and the one for restore.
    – yami
    2 days ago






  • 1




    Sorry, the statement is SELECT pg_get_viewdef('non_life.fo_search'::regclass). It should be house_1 rather than house in this part of the query: LEFT JOIN (... JOIN ... JOIN ...JOIN ...) house(id, policy_object_id,....
    – Laurenz Albe
    yesterday


















  • What is the exact command line you used for pg_restore?
    – a_horse_with_no_name
    2 days ago










  • From pgadmin4 in webbrowser i used backup to dictionary with pre-data, post-data and data
    – yami
    2 days ago










  • I dumped also with command pg_dump -U postgres -h localhost --format=d --file=mydatabase.sqlc databaseName
    – yami
    2 days ago










  • @a_horse_with_no_name I added command for dump and the one for restore.
    – yami
    2 days ago






  • 1




    Sorry, the statement is SELECT pg_get_viewdef('non_life.fo_search'::regclass). It should be house_1 rather than house in this part of the query: LEFT JOIN (... JOIN ... JOIN ...JOIN ...) house(id, policy_object_id,....
    – Laurenz Albe
    yesterday
















What is the exact command line you used for pg_restore?
– a_horse_with_no_name
2 days ago




What is the exact command line you used for pg_restore?
– a_horse_with_no_name
2 days ago












From pgadmin4 in webbrowser i used backup to dictionary with pre-data, post-data and data
– yami
2 days ago




From pgadmin4 in webbrowser i used backup to dictionary with pre-data, post-data and data
– yami
2 days ago












I dumped also with command pg_dump -U postgres -h localhost --format=d --file=mydatabase.sqlc databaseName
– yami
2 days ago




I dumped also with command pg_dump -U postgres -h localhost --format=d --file=mydatabase.sqlc databaseName
– yami
2 days ago












@a_horse_with_no_name I added command for dump and the one for restore.
– yami
2 days ago




@a_horse_with_no_name I added command for dump and the one for restore.
– yami
2 days ago




1




1




Sorry, the statement is SELECT pg_get_viewdef('non_life.fo_search'::regclass). It should be house_1 rather than house in this part of the query: LEFT JOIN (... JOIN ... JOIN ...JOIN ...) house(id, policy_object_id,....
– Laurenz Albe
yesterday




Sorry, the statement is SELECT pg_get_viewdef('non_life.fo_search'::regclass). It should be house_1 rather than house in this part of the query: LEFT JOIN (... JOIN ... JOIN ...JOIN ...) house(id, policy_object_id,....
– Laurenz Albe
yesterday

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53410334%2fpg-dump-error-while-restoring-missing-from-clause%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53410334%2fpg-dump-error-while-restoring-missing-from-clause%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Contact image not getting when fetch all contact list from iPhone by CNContact

count number of partitions of a set with n elements into k subsets

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks