Stephan Szabo <[EMAIL PROTECTED]> writes: > On Mon, 20 Jun 2005, Tom Lane wrote: >> I don't think so --- at least not in plpgsql, which can do this already. >> Just assign the value to a text variable and then use quote_literal.
> Would that work for a bytea with embedded nul characters or does that run > the risk of terminating the value early? Works for me: regression=# create function froob(bytea) returns text as $$ regression$# declare t text; regression$# begin regression$# t := $1; regression$# return quote_literal(t); regression$# end$$ language plpgsql; CREATE FUNCTION regression=# select froob('\\377\\000\\377'::bytea); froob ------------------- '\\377\\000\\377' (1 row) regression=# regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives? http://archives.postgresql.org