On 12/6/05, Michael Fuhr <mike(at)fuhr(dot)org> wrote:
>
> How about:
> CREATE FUNCTION inet2num(inet) RETURNS numeric AS $$
> use Socket;
> return unpack("N", inet_aton($_[0]));
> $$ LANGUAGE plperlu IMMUTABLE STRICT;
>
you can use this one:
... AS $$
return unpack("N", pack("C4", split(/\./, $_[0])));
$$ language plperl IMMUTABLE STRICT;
to avoid the need to use untrusted languages.
it is less readable thought :(
depesz