From: | Michael Fuhr <mike(at)fuhr(dot)org> |
---|---|
To: | Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au> |
Cc: | Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: inet to bigint? |
Date: | 2005-12-06 08:15:08 |
Message-ID: | 20051206081508.GA77261@winnie.fuhr.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, Dec 06, 2005 at 04:10:22PM +0800, Christopher Kings-Lynne wrote:
> >Sheesh, arbitrary restrictions ;-) Something like this then:
> >
> >CREATE FUNCTION inet2num(inet) RETURNS numeric AS $$
> >DECLARE
> > a text[] := string_to_array(host($1), '.');
> >BEGIN
> > RETURN a[1]::numeric * 16777216 +
> > a[2]::numeric * 65536 +
> > a[3]::numeric * 256 +
> > a[4]::numeric;
> >END;
> >$$ LANGUAGE plpgsql IMMUTABLE STRICT;
>
> Cool, and now the reverse? :D
Tom posted one just a couple of days ago:
http://archives.postgresql.org/pgsql-general/2005-12/msg00191.php
> (I'll credit you in the MySQL Compat Library code btw) If you're
> interested, you'd be welcome to join the project btw...
I haven't been following it but I might have some time. Is there
a TODO list? The one I see on pgfoundry is empty.
--
Michael Fuhr
From | Date | Subject | |
---|---|---|---|
Next Message | Nicolai Tufar | 2005-12-06 08:52:24 | Re: [PATCHES] snprintf() argument reordering not working under Windows in 8.1 |
Previous Message | Christopher Kings-Lynne | 2005-12-06 08:10:22 | Re: inet to bigint? |