| From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> | 
|---|---|
| To: | PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> | 
| Subject: | proposal: unescape_text function | 
| Date: | 2020-06-22 03:48:48 | 
| Message-ID: | CAFj8pRA5GnKT+gDVwbVRH2ep451H_myBt+NTz8RkYUARE9+qOQ@mail.gmail.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-hackers | 
Hi
There is one user request for unescape function in core.
This request is about possibility that we do with string literal via
functional interface instead string literals only
I wrote plpgsql function, but built in function can be simpler:
CREATE OR REPLACE FUNCTION public.unescape(text, text)
 RETURNS text
 LANGUAGE plpgsql
 AS $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?
Regards
Pavel
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Paquier | 2020-06-22 04:35:18 | Re: Add support for INDEX_CLEANUP and TRUNCATE to vacuumdb | 
| Previous Message | Amit Kapila | 2020-06-22 02:56:14 | Re: Resetting spilled txn statistics in pg_stat_replication |