Re: cidr data type question

From: John R Pierce <pierce(at)hogranch(dot)com>
To: v(dot)tolstov(at)selfip(dot)ru
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: cidr data type question
Date: 2009-11-02 08:34:22
Message-ID: 4AEE998E.1080502@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Vasiliy G Tolstov wrote:
> Hello.
> I have table with cidr data type column (table is white/black list of
> networks).
>
> Does it possible to query - is the some address contains in any cidr
> network in this table? (for all networks in the table do "contains or equals"
>
> http://www.postgresql.org/docs/8.4/interactive/functions-net.html

SELECT * FRMO mytable WHERE mytable.network >>= $1::INET;

that will return all rows of mytable which have a subnet that includes
the IP or subnet $1

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Vasiliy G Tolstov 2009-11-02 08:49:25 Re: cidr data type question
Previous Message Albe Laurenz 2009-11-02 08:26:09 Re: pg_start_backup question