Alvaro Herrera <alvherre@atentus.com> writes:
> Tom Lane dijo:
>> regression=# select ("bit"((date_part('doy', now()))::integer))::text;
>> ERROR: Cannot cast type bit to text
> Well, there is:
> testing=> select varcharin(bit_out(bitv), 0, length(bitv)+4 ) FROM
> (select "bit"(1) AS bitv) as t;
Oh, of course, I keep forgetting that now that cstring is a first-class
type, all things are possible via abutted I/O function calls ;-)
You could simplify that as
select varcharin(bit_out("bit"(1)), 0, -1);
But either way you must admit that the above is an ugly hack not proper
support.
regards, tom lane