16 lines
467 B
PL/PgSQL
16 lines
467 B
PL/PgSQL
CREATE OR REPLACE FUNCTION public.get_urls_and_paths(website_name text) RETURNS TABLE (out_url text, out_website_name text)
|
|
LANGUAGE plpgsql
|
|
AS $$
|
|
BEGIN
|
|
RETURN QUERY SELECT aw.url, aw.folder_path
|
|
FROM artist_website aw
|
|
INNER JOIN website w ON aw.website_id = w.id
|
|
WHERE w.name ILIKE website_name;
|
|
|
|
IF NOT FOUND THEN
|
|
RAISE EXCEPTION 'No urls and paths found for website: %', website_name;
|
|
END IF;
|
|
|
|
RETURN;
|
|
END;
|
|
$$; |