Followup. Replaced Big Ugly Function with: CREATE OR REPLACE FUNCTION _my_expand(TEXT) RETURNS TEXT AS $$ -- private func, expand various compact links DECLARE str TEXT = $1; links RECORD;
BEGIN FOR links IN SELECT short_link, long_link FROM short_links LOOP str := REGEXP_REPLACE(str, links.short_link, links.long_link, 'g'); END LOOP; RETURN str; END $$ LANGUAGE plpgsql IMMUTABLE; By the way, those who haven't read this gem should probably do so: <http://database-programmer.blogspot.com/2008/05/minimize-code-maximize- data.html> regards, -- Leif Biberg Kristensen http://solumslekt.org/ -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql