]> git.8kb.co.uk Git - postgresql/pg_settings_history/commitdiff
Stop doing useless work master
authorglyn <glyn@8kb.co.uk>
Fri, 5 Dec 2014 18:22:49 +0000 (18:22 +0000)
committerglyn <glyn@8kb.co.uk>
Fri, 5 Dec 2014 18:22:49 +0000 (18:22 +0000)
pg_settings_history.plpgsql

index 371b9f8f8c255dad0c29582e4edfd8ca139061f6..3c7102f728cfa0fbf9b8374ddf64d8f5f414ff26 100755 (executable)
@@ -59,13 +59,17 @@ BEGIN
         
         GET DIAGNOSTICS v_changes = ROW_COUNT;
 
-        -- Update the snapshot ready for the next run.
-        TRUNCATE public.pg_settings_last;
-        INSERT INTO pg_settings_last (name, setting, unit, category, short_desc, extra_desc, context, vartype, source, min_val, 
+        IF (v_changes > 0) THEN
+            -- Update the snapshot ready for the next run.
+            TRUNCATE public.pg_settings_last;
+            INSERT INTO pg_settings_last (name, setting, unit, category, short_desc, extra_desc, context, vartype, source, min_val, 
                 max_val, enumvals, boot_val, reset_val, sourcefile, sourceline)
-        SELECT * FROM pg_settings;
-    
-        RETURN (v_changes > 0);
+            SELECT * FROM pg_settings;
+
+            RETURN true;
+       ELSE 
+            RETURN false;
+       END IF; 
     END IF;    
 END;