Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The ip4/ip4r data type is fantastic as well if you just need to store an ip address.

(https://github.com/RhodiumToad/ip4r-historical/blob/master/R...)



I have to add that RhodiumToad is a class act on IRC, and an SQL wizard. I was using the ip4r datatype for something really annoying at work, and eventually needed some hairy SQL. He steered me away from recursive queries into window functions, and wrote a correct query to solve my problem (basically normalizing overlapping IP ranges and some associated metadata with each range) in less than 30 minutes.

I really couldn't say how much time and money he saved me, but it was a lot.


Joe, this is definitely an awesome datatype, what is painful is building it typically or at least it was years ago when I dealt with it. I'm sure it's gotten better but still, I'd love to see this packaged up as a contrib just like hstore.


If you run Debian (or a derivate) you can download it using apt-get from apt.postgresql.org, and then just run "CREATE EXTENSION ip4r;" to install it into a specific database.

http://wiki.postgresql.org/wiki/Apt


It is an extension. You download the extension tarball[1], make, make install, then run 'create extension ip4r'.

[1] http://pgfoundry.org/frs/download.php/3383/ip4r-extension-2....




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: