summaryrefslogtreecommitdiff
path: root/src/db/rest/util/_api_raise_not_found.sql
diff options
context:
space:
mode:
Diffstat (limited to 'src/db/rest/util/_api_raise_not_found.sql')
-rw-r--r--src/db/rest/util/_api_raise_not_found.sql16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/db/rest/util/_api_raise_not_found.sql b/src/db/rest/util/_api_raise_not_found.sql
new file mode 100644
index 0000000..f4997a6
--- /dev/null
+++ b/src/db/rest/util/_api_raise_not_found.sql
@@ -0,0 +1,16 @@
+CREATE FUNCTION _api.raise_not_found()
+RETURNS BOOLEAN
+LANGUAGE plpgsql VOLATILE
+AS $BODY$
+BEGIN
+ PERFORM _api.raise(
+ _msg => 'api_not_found',
+ _err => 404
+ );
+
+ RETURN TRUE;
+END
+$BODY$;
+
+GRANT EXECUTE ON FUNCTION _api.raise_not_found()
+ TO rest_anon, rest_user;