assert tool for use with \set ON_ERROR_STOP on
authorJason Etheridge <jason@esilibrary.com>
Thu, 30 Mar 2017 17:18:25 +0000 (13:18 -0400)
committerJason Etheridge <jason@esilibrary.com>
Thu, 30 Mar 2017 17:18:25 +0000 (13:18 -0400)
Signed-off-by: Jason Etheridge <jason@esilibrary.com>

sql/base/base.sql

index 8f16f68..7eb55e0 100644 (file)
@@ -2449,3 +2449,21 @@ CREATE OR REPLACE FUNCTION migration_tools.find_circ_matrix_matchpoint (INTEGER)
         )
     );
 $$ LANGUAGE SQL;
+
+CREATE OR REPLACE FUNCTION migration_tools.assert (BOOLEAN) RETURNS VOID AS $$
+    DECLARE
+        test ALIAS FOR $1;
+    BEGIN
+        ASSERT test;
+    END;
+$$ LANGUAGE PLPGSQL STRICT VOLATILE;
+
+CREATE OR REPLACE FUNCTION migration_tools.assert (BOOLEAN,TEXT) RETURNS VOID AS $$
+    DECLARE
+        test ALIAS FOR $1;
+        msg ALIAS FOR $2;
+    BEGIN
+        ASSERT test, msg;
+    END;
+$$ LANGUAGE PLPGSQL STRICT VOLATILE;
+