move stuff to plpgsql

This commit is contained in:
2024-11-01 23:43:12 +01:00
parent 5ac62dcd21
commit d41707ff88
2 changed files with 27 additions and 20 deletions

12
sql/website_exists.sql Normal file
View File

@ -0,0 +1,12 @@
CREATE OR REPLACE FUNCTION website_exists(in_website_name text) RETURNS boolean AS $$
BEGIN
PERFORM * FROM website w
WHERE w.name = in_website_name;
IF FOUND THEN
RETURN 1;
ELSE
RETURN 0;
END IF;
END;
$$ LANGUAGE plpgsql STRICT;