Can't restore view with pg_restore

From: Florian Gossin <fluancefg(at)gmail(dot)com>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Can't restore view with pg_restore
Date: 2017-05-24 14:18:12
Message-ID: CAPW7RP=YgN+sa_TV2OvQ5404bJ9vA9_YAOd7upJNiNLbtg4qvw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hello,

I'm writing here, however I'm not sure if it's a bug or if there's
something I don't understand correctly.

I'm doing a dump in directory format of database with several schemas using
pg_dump and when I try to restore it using pg_restore, I get the following
error:

ERROR: could not convert table "bmv_visits_list" to a view because it has
triggers
STATEMENT: CREATE RULE "_RETURN" AS
ON SELECT TO bmv_visits_list DO INSTEAD SELECT patient.firstname,
patient.lastname,
patient.birthdate,
company.code,
jsonb_agg(jsonb_build_object('nb', v.nb, 'admissiondt', v.admitdt,
'patientroom', v.patientroom)) AS visits
FROM (((ehealth.visit v
JOIN ehealth.company ON ((v.company_id = company.id)))
JOIN ehealth.m_rd_opa_pcl pcl ON ((((v.patientclass)::text =
(pcl.code)::text) AND (v.company_id = pcl.company_id))))
JOIN ehealth.patient ON ((patient.id = v.patient_id)))
WHERE (((v.patientclass)::text <> 'DEVE'::text) AND ((pcl.hl7code)::text =
'I'::text) AND ((v.admitstatus)::text = 'admitted'::text) AND
((v.dischargedt IS NULL) OR (v.dischargedt > ('now'::text)::timestamp
without time zone)))
GROUP BY patient.id, company.code;

I don't understand what the message means in that context.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Robert Haas 2017-05-24 14:24:19 Re: [HACKERS] Concurrent ALTER SEQUENCE RESTART Regression
Previous Message Florian Gossin 2017-05-24 14:10:36 Can't restore view