DROP FUNCTION IF EXISTS rs_lower (VARCHAR) CASCADE;

CREATE FUNCTION rs_lower(VARCHAR) RETURNS VARCHAR AS '
DECLARE
    v_string ALIAS FOR $1;
    s VARCHAR;
    cnt INTEGER;
    lowerCase VARCHAR := ''ａｂｃｄｅｆｇｈｉｊｋｌｍｎｏｐｑｒｓｔｕｖｗｘｙｚⅰⅱⅲⅳⅴⅵⅶⅷⅸⅹαβγδεζηθικλμνξοπρστυφχψω'';
    upperCase VARCHAR := ''ＡＢＣＤＥＦＧＨＩＪＫＬＭＮＯＰＱＲＳＴＵＶＷＸＹＺⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩ'';
   
BEGIN
    s = lower(v_string);
    RETURN translate(s, upperCase, lowerCase);
END;
' LANGUAGE 'plpgsql';