]> granicus.if.org Git - postgis/commitdiff
probe_geometry_columns() return message extended
authorSandro Santilli <strk@keybit.net>
Fri, 4 Jun 2004 13:11:21 +0000 (13:11 +0000)
committerSandro Santilli <strk@keybit.net>
Fri, 4 Jun 2004 13:11:21 +0000 (13:11 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@591 b70326c6-7e19-0410-871a-916f4a2858ee

postgis.sql.in

index 3740dde0d25bd8705733bfbd2833cf11edb5402c..3f55930645ae1b27346a66c4ff007f36a666e3b4 100644 (file)
@@ -476,7 +476,31 @@ CREATEFUNCTION probe_geometry_columns() RETURNS text AS
 '
 DECLARE
        inserted integer;
+       oldcount integer;
+       probed integer;
 BEGIN
+
+       SELECT count(*) INTO oldcount FROM geometry_columns;
+
+       SELECT count(*) INTO probed
+               FROM pg_class c, pg_attribute a, pg_type t, 
+#if USE_VERSION >= 73
+                       pg_namespace n,
+#endif
+                       pg_constraint sridcheck, pg_constraint typecheck
+               WHERE t.typname = ''geometry''
+               AND a.atttypid = t.oid
+               AND a.attrelid = c.oid
+#if USE_VERSION >= 73
+               AND c.relnamespace = n.oid
+               AND sridcheck.connamespace = n.oid
+               AND typecheck.connamespace = n.oid
+#endif
+               AND sridcheck.conrelid = c.oid
+               AND sridcheck.conname = ''$1''
+               AND typecheck.conrelid = c.oid
+               AND typecheck.conname = ''$2'';
+
        INSERT INTO geometry_columns SELECT
                ''''::varchar as f_table_catalogue,
 #if USE_VERSION >= 73
@@ -528,7 +552,10 @@ BEGIN
 
        GET DIAGNOSTICS inserted = ROW_COUNT;
 
-        RETURN ''new records: ''||inserted;
+        RETURN ''probed:''||probed||
+               '' inserted:''||inserted||
+               '' conflicts:''||probed-inserted||
+               '' stale:''||oldcount-probed;
 END
 
 ' LANGUAGE 'plpgsql';