PostgreSQL and network operators

I am working on a couple of projects that require the use of PostgreSQL and I really like dealing with it. Full of features that are sometimes quite usefull. One of them is the <<= network operator.

is contained within or equals – inet ’192.168.1/24′ <<= inet ’192.168.1/24′

This way one can check if an ip is in the range of a given network. Pretty simple, yeah! But I had the need to query ip address that are not in a specific network range :) . Well there is no opposite operator – at least I couldn’t find one. So what I did is is the following:

SELECT COUNT(*) FROM ips WHERE  CASE WHEN ip <<= inet '192.168.1/24' THEN false ELSE true END

This post is also available in: Bulgarian

    • Robin Norris
    • April 2nd, 2013 6:39pm

    I like the <<= operator. Unfortunately, in my environment using it is a little bit more costly than doing a between for the network range. Ex.

    source_addr between and


    source_addr <<=

    Might just be worth it for some queries, just to avoid the typing though. :)

    • simerioscarden
    • December 5th, 2014 6:44am

    Built into the induce system is the crown for ones watch. Purposefully substantial, it is a lot easier to own and hand wind sit back and watch (in the event that desired) as opposed to it seems. The pusher to your chronograph will be in the heart of the crown, and that is certainly what a trigger depresses. Without any sort of wiggle plus a solid look and feel, I would be likely to consider the smaller size and refined structure and materials for the chronograph induce rolex replica au being an upgrade on the the former generation associated with watches. Living with all the dial from the watch for some time now I often say that i not solely appreciate her legibility, but your slick design is becoming quite beautiful personally. There might be nothing extremely shiny and polished, and studying it in numerous different lighting style scenarios provides proven comfy.

  1. You to absorb , to achieve it, you manage to accumulate smart it yet .

  2. I will not be able to arrest delay has been added from you . This is a rich TV absolutely .

  3. I would like to thank in an effort to accept a trial in this article is your handwriting .

  4. But I had the need to query ip address that are not in a specific network range

  5. Is it similar to the way O2 and Three offer WiFi calling & texting, by using a dedicated app? Read on and find out everything you need to know about EE’s new WiFi calling service.

  6. Since Moto X’s Moto Voice uses Google Now, it has to send your voice commands to that service so that creates an additional layer to go through. This means that commands take a little bit longer to execute on Moto Voice when compared to S Voice.

  7. led flood lighting OAK LED Co ,Limited is one of the top level China LED flood lighting manufacturers and suppliers with one of the famous LED flood lighting brands, as a professional company, we have our own factory, which is able to produce high quality products with reliable quality led flood lighting

  1. No trackbacks yet.