Is there a builtin Postgres function that converts multi-line text into ASCII escaped or HTML escaped form and vice versa?

I need to store multi-line text as name=value pairs, basically line .ini files, where Value is the escaped text which should fit on a single line, but I prefer a format that doesn't use numeric codes to express the non-printing characters if such a format is available.

The multi-line text is not that short and could be upto 65K in length.

Postgres does something similar when it converts multi-line text as single lines in plain format backups without using SQL inserts. It is the type of text passed to the COPY tablename (column1, column2, columnxx)from stdin when the plain text backup is viewed.

I have tried quote_literal but it didn't come out the way I want.

Is the function that does the conversion standalone?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.