Open sjib opened 1 month ago
@sjib ALTER TABLE tdh_od.pipe_point_normal ALTER CONSTRAINT oorel_od_pipe_point_normal_pipe_point DEFERRABLE INITIALLY DEFERRED
I followed your instructions, but did have any success 👎 with fme (also run set constraints all deferred (sql to run before write) Bulk copy failed on table 'tdh_od.trench_line' using delimiter ':'. Error was 'ERROR: insert or update on table "trench_line" violates foreign key constraint "rel_trench_line_trench" DETAIL: Key (fk_trench)=(1) is not present in table "trench".
@jpdupuy This is not the problem of pipe_point subclasses anymore (?) but of trench_line.fk_trench You have to set DEFERRABLE INITIALLY DEFERRED for that relation also. If this is a new error then the first step was a success.
If this is successful I can add DEFERRABLE INITIALLY DEFERRED to all relations as with tww
@sjib Yes, it was successful, thanks
@jpdupuy Here the code as discussed for your migration:
--- Add additional DEREFERABLE constraints to data model
ALTER TABLE tdh_od.pipe_point_feed ALTER CONSTRAINT oorel_od_pipe_point_feed_pipe_point DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE tdh_od.pipe_point_norma ALTER CONSTRAINT oorel_od_pipe_point_norma_pipe_point DEFERRABLE INITIALLY DEFERRED;
And maybe add in FME this call before the whole import or do it manually before running the import:
SET CONSTRAINTS ALL DEFERRED;
and then set back at the end