3 ms·
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/README.ip4r ht
by joevandyk 12y ago
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/README.ip4r https://github.com/RhodiumToad/ip4r-historical/blob/master/R...)
- craigkerstiens 12y agoJoe, 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.
- joevandyk 12y agoIt 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.0.tgz http://pgfoundry.org/frs/download.php/3383/ip4r-extension-2....
- jeltz 12y agoIf 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 http://wiki.postgresql.org/wiki/Apt
- empthought 12y agoI 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.