[SCM] PostGIS branch master updated. 3.4.0rc1-950-g5d7f02582

git at osgeo.org git at osgeo.org
Wed Feb 28 06:26:24 PST 2024


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".

The branch, master has been updated
       via  5d7f02582a78549a0ca32f03190a7cd019411689 (commit)
      from  f64b082efca3986205253ffee3fd0f1b421ee0db (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 5d7f02582a78549a0ca32f03190a7cd019411689
Author: Sandro Santilli <strk at kbt.io>
Date:   Wed Feb 28 15:27:07 2024 +0100

    Move populate_topology_layer function in its own file
    
    Ready for future enhancements

diff --git a/topology/Makefile.in b/topology/Makefile.in
index be2afd862..ef8de4bb9 100644
--- a/topology/Makefile.in
+++ b/topology/Makefile.in
@@ -142,6 +142,7 @@ topology.sql: \
 	sql/manage/FindLayer.sql.in \
 	sql/manage/FindTopology.sql.in \
 	sql/manage/ManageHelper.sql.in \
+	sql/manage/populate_topology_layer.sql.in \
 	sql/manage/RenameTopology.sql.in \
 	sql/manage/TopologySummary.sql.in \
 	sql/manage/ValidateTopologyRelation.sql.in \
diff --git a/topology/sql/manage/populate_topology_layer.sql.in b/topology/sql/manage/populate_topology_layer.sql.in
new file mode 100644
index 000000000..0378897f7
--- /dev/null
+++ b/topology/sql/manage/populate_topology_layer.sql.in
@@ -0,0 +1,47 @@
+-- {
+--
+-- populate_topology_layer
+--
+-- Register missing layers into topology.topology, looking at
+-- their constraints.
+--
+-- The function doesn't attempt to determine if a layer is
+-- hierarchical or primitive, but always assumes primitive.
+--
+-- }{
+CREATE OR REPLACE FUNCTION topology.populate_topology_layer()
+	RETURNS TABLE(schema_name text, table_name text, feature_column text)
+AS
+$$
+  INSERT INTO topology.layer
+  WITH checks AS (
+  SELECT
+    n.nspname sch, r.relname tab,
+    replace(c.conname, 'check_topogeom_', '') col,
+    --c.consrc src,
+    regexp_matches(c.consrc,
+      E'\\.topology_id = (\\d+).*\\.layer_id = (\\d+).*\\.type = (\\d+)') inf
+  FROM (SELECT conname, connamespace, conrelid, conkey, pg_get_constraintdef(oid) As consrc
+		    FROM pg_constraint) AS c, pg_class r, pg_namespace n
+  WHERE c.conname LIKE 'check_topogeom_%'
+    AND r.oid = c.conrelid
+    AND n.oid = r.relnamespace
+  ), newrows AS (
+    SELECT inf[1]::int as topology_id,
+           inf[2]::int as layer_id,
+          sch, tab, col, inf[3]::int as feature_type --, src
+    FROM checks c
+    WHERE NOT EXISTS (
+      SELECT * FROM topology.layer l
+      WHERE l.schema_name = c.sch
+        AND l.table_name = c.tab
+        AND l.feature_column = c.col
+    )
+  )
+  SELECT topology_id, layer_id, sch,
+         tab, col, feature_type,
+         0, NULL
+  FROM newrows RETURNING schema_name,table_name,feature_column;
+$$
+LANGUAGE 'sql' VOLATILE;
+--}
diff --git a/topology/topology.sql.in b/topology/topology.sql.in
index 5746794c5..afe5b576d 100644
--- a/topology/topology.sql.in
+++ b/topology/topology.sql.in
@@ -648,53 +648,6 @@ LANGUAGE 'plpgsql' VOLATILE;
 --
 --} DropTopoGeometryColumn
 
--- {
---
--- populate_topology_layer
---
--- Register missing layers into topology.topology, looking at
--- their constraints.
---
--- The function doesn't attempt to determine if a layer is
--- hierarchical or primitive, but always assumes primitive.
---
--- }{
-CREATE OR REPLACE FUNCTION topology.populate_topology_layer()
-	RETURNS TABLE(schema_name text, table_name text, feature_column text)
-AS
-$$
-  INSERT INTO topology.layer
-  WITH checks AS (
-  SELECT
-    n.nspname sch, r.relname tab,
-    replace(c.conname, 'check_topogeom_', '') col,
-    --c.consrc src,
-    regexp_matches(c.consrc,
-      E'\\.topology_id = (\\d+).*\\.layer_id = (\\d+).*\\.type = (\\d+)') inf
-  FROM (SELECT conname, connamespace, conrelid, conkey, pg_get_constraintdef(oid) As consrc
-		    FROM pg_constraint) AS c, pg_class r, pg_namespace n
-  WHERE c.conname LIKE 'check_topogeom_%'
-    AND r.oid = c.conrelid
-    AND n.oid = r.relnamespace
-  ), newrows AS (
-    SELECT inf[1]::int as topology_id,
-           inf[2]::int as layer_id,
-          sch, tab, col, inf[3]::int as feature_type --, src
-    FROM checks c
-    WHERE NOT EXISTS (
-      SELECT * FROM topology.layer l
-      WHERE l.schema_name = c.sch
-        AND l.table_name = c.tab
-        AND l.feature_column = c.col
-    )
-  )
-  SELECT topology_id, layer_id, sch,
-         tab, col, feature_type,
-         0, NULL
-  FROM newrows RETURNING schema_name,table_name,feature_column;
-$$
-LANGUAGE 'sql' VOLATILE;
-
 --{
 -- CreateTopoGeom(topology_name, topogeom_type, layer_id, elements)
 --
@@ -1444,6 +1397,7 @@ LANGUAGE 'plpgsql' VOLATILE STRICT;
 #include "sql/manage/CopyTopology.sql.in"
 #include "sql/manage/FindTopology.sql.in"
 #include "sql/manage/FindLayer.sql.in"
+#include "sql/manage/populate_topology_layer.sql.in"
 #include "sql/manage/RenameTopology.sql.in"
 #include "sql/manage/ValidateTopology.sql.in"
 #include "sql/manage/ValidateTopologyRelation.sql.in"

-----------------------------------------------------------------------

Summary of changes:
 topology/Makefile.in                               |  1 +
 topology/sql/manage/populate_topology_layer.sql.in | 47 +++++++++++++++++++++
 topology/topology.sql.in                           | 48 +---------------------
 3 files changed, 49 insertions(+), 47 deletions(-)
 create mode 100644 topology/sql/manage/populate_topology_layer.sql.in


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list