diff options
Diffstat (limited to 'db/rev.sql')
-rw-r--r-- | db/rev.sql | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/db/rev.sql b/db/rev.sql new file mode 100644 index 0000000..dff1cfe --- /dev/null +++ b/db/rev.sql @@ -0,0 +1,21 @@ +CREATE OR REPLACE FUNCTION curr_revision() +RETURNS INTEGER +LANGUAGE plpgsql VOLATILE +AS $BODY$ +DECLARE + _revision INTEGER; +BEGIN + BEGIN + SELECT curr_revision INTO _revision + FROM sys.database_info + WHERE name = current_database(); + RETURN _revision; + EXCEPTION WHEN OTHERS THEN + RETURN 0; + END; +END +$BODY$; + +GRANT EXECUTE ON FUNCTION curr_revision() TO xssbook; + +SELECT curr_revision(); |