Re: BIN() - Mailing list pgsql-hackers

From Christopher Kings-Lynne
Subject Re: BIN()
Date
Msg-id 438D1F24.5070407@familyhealth.com.au
Whole thread Raw
In response to Re: BIN()  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers

Tom Lane wrote:
> Christopher Kings-Lynne <chriskl@familyhealth.com.au> writes:
> 
>>>test=> SELECT ltrim(textin(bit_out(12::bit(64))), '0');
>>>ltrim 
>>>-------
>>>1100
>>>(1 row)
> 
> 
>>Sweeeeet.  Good old i/o functions.
> 
> 
> Who needs the I/O functions?  Just cast int to bit(n).

Then how do you remove all leading zeros, and make sure you choose a 
high enough 'n'?

Chris



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: BIN()
Next
From: Andrew Dunstan
Date:
Subject: Re: BIN()