Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: BIN()


  • From: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
  • To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
  • Cc: Michael Fuhr <mike(at)fuhr(dot)org>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Hackers <pgsql-hackers(at)postgresql(dot)org>
  • Subject: Re: BIN()
  • Date: Wed, 30 Nov 2005 11:40:20 +0800
  • Message-id: <438D1F24(dot)5070407(at)familyhealth(dot)com(dot)au>



Tom Lane wrote:
Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)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




Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group