From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Michael Fuhr <mike(at)fuhr(dot)org> |
Cc: | Együd Csaba <csegyud(at)vnet(dot)hu>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Any functions to convert bit(5) to text? |
Date: | 2005-02-10 15:23:27 |
Message-ID: | 26851.1108049007@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Michael Fuhr <mike(at)fuhr(dot)org> writes:
> On Thu, Feb 10, 2005 at 12:16:53AM -0700, Michael Fuhr wrote:
>> SELECT textin(bit_out(b)) FROM foo;
> Is it generally true that you can convert between types using the
> above method, assuming compatible syntax?
IIRC, this has been reasonably safe since we made cstring into an actual
datatype, which was 7.3 or so. Before that it was real easy to crash
the backend by trying to invoke I/O functions directly (mainly because
the old convention involving OPAQUE didn't afford any opportunity to do
type checking).
> Is that how the PL/pgSQL RETURN trick works?
plpgsql has always done this under-the-hood for assignment across
disparate data types. I'd recommend using a plpgsql function rather
than messing with the I/O functions directly. For one thing, you don't
have to look up the function names/signatures that way ;-)
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Fuhr | 2005-02-10 15:30:13 | Re: a SELECT FOR UPDATE question |
Previous Message | Ed L. | 2005-02-10 15:04:52 | Re: Understanding EXPLAIN ANALYZE output |