From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
---|---|
To: | Michael Fuhr <mike(at)fuhr(dot)org> |
Cc: | Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>, Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: BIN() |
Date: | 2005-11-30 04:45:18 |
Message-ID: | 438D2E5E.2020508@dunslane.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Michael Fuhr wrote:
>On Tue, Nov 29, 2005 at 09:46:13PM -0500, Andrew Dunstan wrote:
>
>
>>create or replace function bin(bigint) returns text language plperl as $$
>>
>> my $arg = $_[0] + 0;
>> my $res = "";
>> while($arg)
>> {
>> $res = ($arg % 2) . $res;
>> $arg >>= 1;
>> }
>> return $res;
>>
>>$$;
>>
>>
>
>Any reason not to use sprintf("%b", $_[0])?
>
>
>
TIMTOWTDI, as we have seen
(also I had forgotten %b if I ever knew it)
cheers
andrew
From | Date | Subject | |
---|---|---|---|
Next Message | sandeep satpal | 2005-11-30 05:10:42 | How to add our functions in postgres |
Previous Message | Robert Treat | 2005-11-30 03:58:34 | Re: [pgsql-advocacy] Please let us know if you will come to the PostgreSQL Anniversary |