chore(*.psql/*.sql): update all *.psql to *.sql files

This commit is contained in:
Cory Dransfeldt 2025-04-30 12:21:33 -07:00
parent c9015a7f2b
commit fc37600b8b
No known key found for this signature in database
63 changed files with 21 additions and 41 deletions

View file

@ -0,0 +1,21 @@
CREATE OR REPLACE FUNCTION normalize_country_field(countryField TEXT)
RETURNS TEXT AS $$
DECLARE
delimiters TEXT[] := ARRAY[',', '/', '&', 'and'];
countries TEXT[];
temp TEXT[];
result TEXT := '';
i INTEGER;
BEGIN
countries := string_to_array(countryField, ',');
FOR i IN 1..array_length(delimiters, 1) LOOP
temp := ARRAY[]::TEXT[];
FOREACH result IN ARRAY countries LOOP
temp := array_cat(temp, string_to_array(result, delimiters[i]));
END LOOP;
countries := temp;
END LOOP;
result := array_to_string(countries, ' ');
RETURN trim(result);
END;
$$ LANGUAGE plpgsql;