Re: Any functions to convert bit(5) to text?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Any functions to convert bit(5) to text?
Дата
Msg-id 26851.1108049007@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Any functions to convert bit(5) to text?  (Michael Fuhr <mike@fuhr.org>)
Список pgsql-general
Michael Fuhr <mike@fuhr.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

В списке pgsql-general по дате отправления:

Предыдущее
От: "Ed L."
Дата:
Сообщение: Re: Understanding EXPLAIN ANALYZE output
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: a SELECT FOR UPDATE question