pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedinet/cidr - can this be done?
2+ messages / 2 participants
[nested] [flat]
* inet/cidr - can this be done?
@ 2000-01-29 18:55 Mark Volpe <volpe.mark@epamail.epa.gov>
2000-01-31 12:21 ` Re: [SQL] inet/cidr - can this be done? Peter Eisentraut <e99re41@DoCS.UU.SE>
0 siblings, 1 reply; 2+ messages in thread
From: Mark Volpe @ 2000-01-29 18:55 UTC (permalink / raw)
To: 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
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [SQL] inet/cidr - can this be done?
2000-01-29 18:55 inet/cidr - can this be done? Mark Volpe <volpe.mark@epamail.epa.gov>
@ 2000-01-31 12:21 ` Peter Eisentraut <e99re41@DoCS.UU.SE>
0 siblings, 0 replies; 2+ messages in thread
From: Peter Eisentraut @ 2000-01-31 12:21 UTC (permalink / raw)
To: Mark Volpe <volpe.mark@epamail.epa.gov>; +Cc: pgsql-sql
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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2000-01-31 12:21 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2000-01-29 18:55 inet/cidr - can this be done? Mark Volpe <volpe.mark@epamail.epa.gov>
2000-01-31 12:21 ` Peter Eisentraut <e99re41@DoCS.UU.SE>
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