Markus Bertheau ☭ <twanger@bluetwanger.de> writes:
>> Just assign the value to a text variable and then use quote_literal.
> Isn't that a workaround? Or is that the way such things are done in
> plpgsql?
It's the way it's done --- plpgsql does this by invoking the datatype
output function and then the text input function. There has been talk
of formalizing that in other contexts by making an explicit cast to text
do that for every datatype, but nothing's been done about it yet.
regards, tom lane