From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> |
Cc: | Markus Bertheau ☭ <twanger(at)bluetwanger(dot)de>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: quote_boolean() and friends missing |
Date: | 2005-06-20 14:39:08 |
Message-ID: | 6852.1119278348@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> 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
From | Date | Subject | |
---|---|---|---|
Next Message | Andreas Pflug | 2005-06-20 14:42:06 | Re: [PATCHES] default database creation with initdb |
Previous Message | Stephan Szabo | 2005-06-20 14:32:52 | Re: quote_boolean() and friends missing |