Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Michael Fuhr <mike@xxxxxxxx> 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

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your
      message can get through to the mailing list cleanly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux