HiThere is one user request for unescape function in core.https://stackoverflow.com/questions/20124393/convert-escaped-unicode-character-back-to-actual-character-in-postgresql/20125412?noredirect=1#comment110502526_20125412This request is about possibility that we do with string literal via functional interface instead string literals onlyI wrote plpgsql function, but built in function can be simpler:CREATE OR REPLACE FUNCTION public.unescape(text, text) RETURNS textLANGUAGE plpgsqlAS $function$DECLARE result text;BEGIN EXECUTE format('SELECT U&%s UESCAPE %s', quote_literal(replace($1, '\u','^')), quote_literal($2)) INTO result; RETURN result;END;$function$postgres=# select unescape('Odpov\u011Bdn\u00E1 osoba','^'); unescape -----------------Odpovědná osoba (1 row)What do you think about this?
CREATE OR REPLACE FUNCTION public.unescape(text, text) RETURNS textLANGUAGE plpgsqlAS $function$DECLARE result text;BEGIN EXECUTE format('SELECT U&%s UESCAPE %s', quote_literal(replace($1, '\u','^')), quote_literal($2)) INTO result; RETURN result;END;$function$
postgres=# select unescape('Odpov\u011Bdn\u00E1 osoba','^'); unescape -----------------Odpovědná osoba (1 row)
RegardsPavel
pgsql-hackers by date:
Соглашаюсь с условиями обработки персональных данных