aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sql/dawn.sql10
1 files changed, 10 insertions, 0 deletions
diff --git a/sql/dawn.sql b/sql/dawn.sql
index 95468dac..03e0bf6c 100644
--- a/sql/dawn.sql
+++ b/sql/dawn.sql
@@ -1705,6 +1705,16 @@ RETURN id;
End;
$$ LANGUAGE plpgsql;
+CREATE OR REPLACE FUNCTION public.id_translate(VARIADIC id1 character varying[])
+RETURNS TABLE(id2 text) AS $$
+BEGIN
+ RETURN QUERY SELECT b.figi FROM
+ (SELECT unnest(id1) AS cusip, generate_subscripts(id1, 1) AS id) a
+ LEFT JOIN (SELECT DISTINCT ON (cusip) * FROM securities) as b
+ USING (cusip) ORDER BY id;
+END;
+$$ LANGUAGE plpgsql;
+
-- Not sure how to map enums so use text for now
CREATE FOREIGN TABLE priced(
model_id_sub smallint,