Skip site navigation (1) Skip section navigation (2)

inet/cidr - can this be done?

From: Mark Volpe <volpe(dot)mark(at)epamail(dot)epa(dot)gov>
To: pgsql-sql(at)postgresql(dot)org
Subject: inet/cidr - can this be done?
Date: 2000-01-29 18:55:35
Message-ID: 389337A7.3F02B63B@epamail.epa.gov (view raw or flat)
Thread:
Lists: 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

Responses

pgsql-sql by date

Next:From: Roland RobertsDate: 2000-01-30 03:59:45
Subject: Where is `COMMENT ON' syntex documented
Previous:From: Peter EisentrautDate: 2000-01-29 11:14:13
Subject: Re: [SQL] transaction aborted

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group