diff options
author | Freya Murphy <freya@freyacat.org> | 2024-03-29 22:29:56 -0400 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2024-03-29 22:29:56 -0400 |
commit | 944b6b0526032ad8c1b4a2612d6723bec75e0e4c (patch) | |
tree | d3da5584df33a7878c087622b4fc2ec2883cf880 /db/rest/util/_api_raise_unique.sql | |
download | xssbook2-944b6b0526032ad8c1b4a2612d6723bec75e0e4c.tar.gz xssbook2-944b6b0526032ad8c1b4a2612d6723bec75e0e4c.tar.bz2 xssbook2-944b6b0526032ad8c1b4a2612d6723bec75e0e4c.zip |
start database (user and post), and initial barebones home page
Diffstat (limited to 'db/rest/util/_api_raise_unique.sql')
-rw-r--r-- | db/rest/util/_api_raise_unique.sql | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/db/rest/util/_api_raise_unique.sql b/db/rest/util/_api_raise_unique.sql new file mode 100644 index 0000000..a18d960 --- /dev/null +++ b/db/rest/util/_api_raise_unique.sql @@ -0,0 +1,18 @@ +CREATE FUNCTION _api.raise_unique( + _column TEXT DEFAULT '' +) +RETURNS BOOLEAN +LANGUAGE plpgsql VOLATILE +AS $BODY$ +BEGIN + PERFORM _api.raise( + _msg => 'api_unique_value', + _detail => _column + ); + + RETURN TRUE; +END +$BODY$; + +GRANT EXECUTE ON FUNCTION _api.raise_unique(TEXT) + TO rest_anon, rest_user; |