21 lines
394 B
PL/PgSQL
21 lines
394 B
PL/PgSQL
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();
|