Re: dotted quad netmask conversion - Mailing list pgsql-general

From Tom Lane
Subject Re: dotted quad netmask conversion
Date
Msg-id 23588.1291740219@sss.pgh.pa.us
Whole thread Raw
In response to Re: dotted quad netmask conversion  (Steve Clark <sclark@netwolves.com>)
Responses Re: dotted quad netmask conversion  (Steve Clark <sclark@netwolves.com>)
List pgsql-general
Steve Clark <sclark@netwolves.com> writes:
> Thanks for the response Jon. I should have stated this PG 8.1.x and '&'
> doesn't exist for network functions.

I don't think & does what you want anyway.  It just does a bit AND on
the two addresses, it doesn't change the masklen property.

There's probably only a small number of distinct netmasks you actually
need to handle in this conversion.  What I'd suggest is writing a simple
function with a CASE statement to translate netmask to an integer mask
length, and then you can use set_masklen to merge that result into the
address value.

            regards, tom lane

pgsql-general by date:

Previous
From: Gabi Julien
Date:
Subject: Postgresql 9.1 pg_last_xact_replay_timestamp limitations
Next
From: Scott Ribe
Date:
Subject: Re: *****SPAM***** Re: if-clause to an exiting statement