Re: get date in binary number format - Mailing list pgsql-general

From Tom Lane
Subject Re: get date in binary number format
Date
Msg-id 20271.1033095137@sss.pgh.pa.us
Whole thread Raw
In response to Re: get date in binary number format  ("Johnson, Shaunn" <SJohnson6@bcbsm.com>)
Responses Re: get date in binary number format  (Alvaro Herrera <alvherre@atentus.com>)
List pgsql-general
"Johnson, Shaunn" <SJohnson6@bcbsm.com> writes:
> I get this when I try the following select:

> testdb=> select "bit"((date_part('doy', now()))::integer);
> ERROR:  Function 'bit(int4)' does not exist

In CVS tip I get

regression=# select "bit"((date_part('doy', now()))::integer);
               bit
----------------------------------
 00000000000000000000000100001101
(1 row)

but I think the int4-to-bit(32) conversion function was added for 7.3.
There also seems to be an int8-to-bit(64) function now:

regression=# select "bit"((date_part('doy', now()))::int8);
                               bit
------------------------------------------------------------------
 0000000000000000000000000000000000000000000000000000000100001101
(1 row)

IIRC, Tom Lockhart put in both of those a couple months ago.

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Unixtime (epoch) into timestamp?
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] Performance while loading data and indexing