You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CREATE OR REPLACE FUNCTION replace_recursive(search text, from_to text [] [])
RETURNS text LANGUAGE plpgsql AS $$
DECLARE
i integer;
result text := search;
BEGIN
FOR i IN 1 .. array_length(from_to, 1) LOOP
result := replace(result, from_to[i][1], from_to[i][2]);
END LOOP;
RETURN result;
END;
$$;
CREATE OR REPLACE FUNCTION replace_delimiters(search text, rep_val text)
RETURNS text LANGUAGE plpgsql AS $$
BEGIN
RETURN regexp_replace(search, '[,.|:;/\_-\t\r\n]', rep_val, 'g');
END;
$$;
{% endmacro %}
Postgres query in DBT
The text was updated successfully, but these errors were encountered:
{% macro replace_recursive() %}
CREATE OR REPLACE FUNCTION replace_recursive(search text, from_to text [] [])
RETURNS text LANGUAGE plpgsql AS $$
DECLARE
i integer;
result text := search;
BEGIN
FOR i IN 1 .. array_length(from_to, 1) LOOP
result := replace(result, from_to[i][1], from_to[i][2]);
END LOOP;
RETURN result;
END;
$$;
CREATE OR REPLACE FUNCTION replace_delimiters(search text, rep_val text)
RETURNS text LANGUAGE plpgsql AS $$
BEGIN
RETURN regexp_replace(search, '[,.|:;/\_-\t\r\n]', rep_val, 'g');
END;
$$;
{% endmacro %}
Postgres query in DBT
The text was updated successfully, but these errors were encountered: