From: Peter Eisentraut <e99re41@DoCS.UU.SE>
To: Mark Volpe <volpe.mark@epamail.epa.gov>
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] inet/cidr - can this be done?
Date: Mon, 31 Jan 2000 13:21:27 +0100 (MET)
Message-ID: <Pine.GSO.4.02A.10001311317150.12762-100000@Hund.DoCS.UU.SE> (raw)
In-Reply-To: <389337A7.3F02B63B@epamail.epa.gov>
The problem is that host(ip)||'/24' isn't of the inet type, it's text. For
a simple select query you don't have to cast this at all, it would seem,
since it goes as text to the frontend either way.
Also, a straightforward cast inet_value::cidr seems to work for me.
On Sat, 29 Jan 2000, Mark Volpe wrote:
> 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
>
> ************
>
>
--
Peter Eisentraut Sernanders vaeg 10:115
peter_e@gmx.net 75262 Uppsala
http://yi.org/peter-e/ Sweden
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: e99re41@DoCS.UU.SE, volpe.mark@epamail.epa.gov
Subject: Re: [SQL] inet/cidr - can this be done?
In-Reply-To: <Pine.GSO.4.02A.10001311317150.12762-100000@Hund.DoCS.UU.SE>
References: <389337A7.3F02B63B@epamail.epa.gov> <Pine.GSO.4.02A.10001311317150.12762-100000@Hund.DoCS.UU.SE>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox