Datatype Inet and Searching

From: "Devin Atencio" <devin(at)burgoyne(dot)com>
To: <pgsql-sql(at)postgresql(dot)org>
Subject: Datatype Inet and Searching
Date: 2003-12-02 23:50:28
Message-ID: 200312022353.hB2Nrnji023049@mail.burgoyne.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Dear Users,

I am very new to using the inet data type and I have a database with a list
of CIDRs in it

And I was hoping to be able to do some kind of select statement that would
pull the record

That the IP given is located in for example. If in my database I have a
record like:

Id cidr name

1 10.0.0.0/30 user1

2 10.0.0.4/30 user2

3 10.0.0.8/30 user3

I was hoping to be able to do something like:

Select * from mytable where cidr <<='10.0.0.5'

And the database would return only record 2 since it knows that 10.0.0.5 is
contained only within record 2.

I can't seem to figure out the correct syntax to make this type of query
happen. Any help would greatly

Be appreciated.

Devin Atencio

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Iain 2003-12-03 02:18:04 Re: Validity check in to_date?
Previous Message Alvar Freude 2003-12-02 23:07:23 [postgres] Text zu bytea casten