modify sql functions
This commit is contained in:
24
sql/get_all_convertable_paths.sql
Normal file
24
sql/get_all_convertable_paths.sql
Normal file
@ -0,0 +1,24 @@
|
||||
CREATE OR REPLACE FUNCTION public.get_all_convertable_paths() RETURNS Table (bad_path text, good_path text)
|
||||
LANGUAGE plpgsql STRICT
|
||||
AS $$
|
||||
DECLARE
|
||||
url text;
|
||||
artist_name text;
|
||||
temp_bad_path text;
|
||||
temp_good_path text;
|
||||
BEGIN
|
||||
FOR url IN
|
||||
SELECT aw.url FROM artist_website aw
|
||||
LOOP
|
||||
artist_name = get_artist_name(url);
|
||||
temp_bad_path = concat('Artists/', artist_name);
|
||||
temp_good_path = concat('Artists/', convert_artist_name(artist_name));
|
||||
|
||||
PERFORM * FROM artist WHERE artist.name = artist_name;
|
||||
|
||||
IF NOT FOUND THEN
|
||||
RETURN QUERY SELECT temp_bad_path,temp_good_path;
|
||||
END IF;
|
||||
END LOOP;
|
||||
END;
|
||||
$$;
|
Reference in New Issue
Block a user