Opened 13 years ago
Closed 13 years ago
#1371 closed defect (fixed)
postgis_restore.pl: insert or update on table "layer" violates foreign key constraint "layer_topology_id_fkey"
Reported by: | strk | Owned by: | strk |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS 2.0.0 |
Component: | topology | Version: | master |
Keywords: | Cc: |
Description
Restoring a dump containing topologies using postgis_restore.pl gives the following error: insert or update on table "layer" violates foreign key constraint "layer_topology_id_fkey"
Change History (5)
comment:1 by , 13 years ago
comment:2 by , 13 years ago
Ok, here's the thing: the _definition_ of layer and topology tables comes from the topology.sql script, not from the dump. This means it is equipped with constraints.
If we restored the tables from the dump we'd get the constraints added later and so wouldn't break them.
I guess this was a problem with geometry_columns as well before it became a view.
comment:3 by , 13 years ago
Tried and works fine. But comparing the tables between 1.5 and 2.0 there's a difference in topology.topology which has an additional field. We would then need a function that adds the field if missing from the table in the dump. But only if the dump does have topology...
comment:4 by , 13 years ago
Another alternative could be disabling triggers on the two tables. Will try that as well before committing. This other alternative has the advantage of having no need to convert the table later.
comment:5 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
The disabling/enabling revealed successful. Didn't test with a dump from 1.5 with topology, but should work. See r8397
The layer table is being populated _before_ the topology table. May be the cause of it: