modify sql functions

This commit is contained in:
2024-11-11 20:20:49 +01:00
parent e5a7906cdf
commit 9af2a9408c
12 changed files with 159 additions and 59 deletions

View File

@ -1,4 +1,6 @@
CREATE OR REPLACE FUNCTION get_artist_name(in_url text) RETURNS text AS $$
CREATE OR REPLACE FUNCTION public.get_artist_name(in_url text) RETURNS text
LANGUAGE plpgsql IMMUTABLE STRICT
AS $$
DECLARE
artist_name text;
BEGIN
@ -17,9 +19,9 @@ BEGIN
ELSIF regexp_like(in_url, 'konachan\.com') THEN
artist_name = substring(in_url from 32);
ELSE
RAISE EXCEPTION 'Cannot extract usable artist_name from url: %', in_url;
RETURN NULL;
END IF;
RETURN artist_name;
END;
$$ LANGUAGE plpgsql IMMUTABLE STRICT;
$$;