proposal: unescape_text function - Mailing list pgsql-hackers

From Pavel Stehule
Subject proposal: unescape_text function
Date
Msg-id CAFj8pRA5GnKT+gDVwbVRH2ep451H_myBt+NTz8RkYUARE9+qOQ@mail.gmail.com
Whole thread Raw
Responses Re: proposal: unescape_text function
List 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 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?

Regards

Pavel

pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Resetting spilled txn statistics in pg_stat_replication
Next
From: Michael Paquier
Date:
Subject: Re: Add support for INDEX_CLEANUP and TRUNCATE to vacuumdb