inet/cidr - can this be done? - Mailing list pgsql-sql

From Mark Volpe
Subject inet/cidr - can this be done?
Date
Msg-id 389337A7.3F02B63B@epamail.epa.gov
Whole thread Raw
Responses Re: [SQL] inet/cidr - can this be done?  (Peter Eisentraut <e99re41@DoCS.UU.SE>)
List pgsql-sql
Is there a way to convert inet types
to cidr? I have a table with an inet
field, and it would be cool to, say,
group by class C network. My little attempt
here results in an error:

CREATE TABLE test(ip inet);
INSERT INTO test VALUES('192.168.1.2');
SELECT (host(ip) || '/24')::cidr FROM test;

ERROR:  No such function 'cidr' with the specified attributes

Thanks in advance
- Mark


pgsql-sql by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: [SQL] transaction aborted
Next
From: root
Date:
Subject: Re: [SQL] transaction aborted