pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
cidr question (resent)
3+ messages / 3 participants
[nested] [flat]

* cidr question (resent)
@ 2001-12-13 02:32  Mir S Islam <mislam@mindspring.com>
  0 siblings, 2 replies; 3+ messages in thread

From: Mir S Islam @ 2001-12-13 02:32 UTC (permalink / raw)
  To: pgsql-sql

Resending this. Aplogies for duplicates if any.


maybe I am not understanding it right. Here is my problem.

I have a table like this

  Attribute   |           Type           | Modifier
--------------+--------------------------+----------
 ip           | cidr                     | not null

with following rows
      ip
---------------
 10.0.0.1/32
 10.0.0.50/32
 10.0.0.255/32
 11.0.0.0/32
 11.0.1.200/32
 11.0.1.20/32
(6 rows)

should not the command
DELETE from ip_space where ip = '11.0.1.0/24'::cidr
delete last two rows ? But it does not delete anything. Basically I would
like to be able to delete a whole range or block of ip/network addresses.

I suppose I could rewrite the above sql as
delete from ip_space where ip >='11.0.1.0/24'::cidr and ip
<='11.0.2.0/24'::cidr;
Then it works. But I should not have to do that. Right ?

Thanks in advance. Please email and post here.

Mir









^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: cidr question (resent)
@ 2001-12-13 03:37  Alex Pilosov <alex@pilosoft.com>
  parent: Mir S Islam <mislam@mindspring.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Alex Pilosov @ 2001-12-13 03:37 UTC (permalink / raw)
  To: Mir S Islam <mislam@mindspring.com>; +Cc: pgsql-sql

On Wed, 12 Dec 2001, Mir S Islam wrote:

> should not the command
> DELETE from ip_space where ip = '11.0.1.0/24'::cidr
> delete last two rows ? But it does not delete anything. Basically I would
> like to be able to delete a whole range or block of ip/network addresses.

You need:
DELETE from ip_space where ip << '11.0.1.0/24'::cidr

<< is 'belongs to'. 

-alex




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: cidr question (resent)
@ 2001-12-13 03:39  David Stanaway <david@netventures.com.au>
  parent: Mir S Islam <mislam@mindspring.com>
  1 sibling, 0 replies; 3+ messages in thread

From: David Stanaway @ 2001-12-13 03:39 UTC (permalink / raw)
  To: pgsql-sql; +Cc: Mir S Islam <mislam@mindspring.com>


There are some operators that you can use.

col1 << col2    BOOLEAN indicating if col1 is a subnet of col2
col1 <<= col2   BOOLEAN indicating if col1 is equal or a subnet of col2
col1 >> col2    BOOLEAN indicating if col1 is a supernet of col2
col1 >>= col2   BOOLEAN indicating if col1 is equal or a supernet of col2


On Thursday, December 13, 2001, at 01:32  PM, Mir S Islam wrote:

> Resending this. Aplogies for duplicates if any.
>
>
> maybe I am not understanding it right. Here is my problem.
>
> I have a table like this
>
>   Attribute   |           Type           | Modifier
> --------------+--------------------------+----------
>  ip           | cidr                     | not null
>
> with following rows
>       ip
> ---------------
>  10.0.0.1/32
>  10.0.0.50/32
>  10.0.0.255/32
>  11.0.0.0/32
>  11.0.1.200/32
>  11.0.1.20/32
> (6 rows)
>
> should not the command
> DELETE from ip_space where ip = '11.0.1.0/24'::cidr
> delete last two rows ? But it does not delete anything. Basically I 
> would
> like to be able to delete a whole range or block of ip/network 
> addresses.
>
> I suppose I could rewrite the above sql as
> delete from ip_space where ip >='11.0.1.0/24'::cidr and ip
> <='11.0.2.0/24'::cidr;
> Then it works. But I should not have to do that. Right ?
>
> Thanks in advance. Please email and post here.
>
> Mir
>
>
>
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo@postgresql.org so that your
> message can get through to the mailing list cleanly
>
>
--
Best Regards
David Stanaway
================================
Technology Manager
Australia's Premier Internet Broadcasters
Phone: +612 9357 1699
Fax: +612 9357 1169
Web: http://www.netventures.com.au
Support: support@netventures.com.au
================================
The Inspire Foundation is proudly supported by Net Ventures through the 
provision of streaming solutions for it's national centres.  The Inspire 
Foundation is an Internet-based foundation that inspires young people to 
help themselves, get involved and get online. Please visit Inspire at 
http://www.inspire.org.au




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2001-12-13 03:39 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-12-13 02:32 cidr question (resent) Mir S Islam <mislam@mindspring.com>
2001-12-13 03:37 ` Alex Pilosov <alex@pilosoft.com>
2001-12-13 03:39 ` David Stanaway <david@netventures.com.au>

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