Populate_Topology_Layer
Name
Populate_Topology_Layer — Adds missing entries to topology.layer table by reading metadata from topo tables.
Synopsis
setof record
Populate_Topology_Layer
(
)
;
Description
Adds missing entries to the
topology.layer
table by inspecting topology constraints on tables.
This function is useful for fixing up entries in topology catalog after restores of schemas with topo data.
It returns the list of entries created. Returned columns are
schema_name
,
table_name
,
feature_column
.
Availability: 2.3.0
Examples
SELECT CreateTopology('strk_topo');
CREATE SCHEMA strk;
CREATE TABLE strk.parcels(gid serial, parcel_id varchar(20) PRIMARY KEY, address text);
SELECT topology.AddTopoGeometryColumn('strk_topo', 'strk', 'parcels', 'topo', 'POLYGON');
createtopology
----------------
1
(1 row)
CREATE SCHEMA
CREATE TABLE
addtopogeometrycolumn
-----------------------
1
(1 row)
This query returns no records because the feature is already registered.
SELECT * FROM topology.Populate_Topology_Layer();
(0 rows)
Rebuild the topology layer catalog.
TRUNCATE TABLE topology.layer;
TRUNCATE TABLE
SELECT * FROM topology.Populate_Topology_Layer();
schema_name | table_name | feature_column -------------+------------+---------------- strk | parcels | topo (1 row)
SELECT topology_id, layer_id,
schema_name AS sn, table_name AS tn, feature_column AS fc
FROM topology.layer;
topology_id | layer_id | sn | tn | fc
-------------+----------+------+---------+------
1 | 1 | strk | parcels | topo
(1 row)