PostgreSQL friendly IPinfodb SQL import

July 24, 2010

Title says it all really. I finally got tired of importing the ipinfodb into postgreSQL via CSV (the SQL they provide on their site targets MySQL), and have made a dump available on S3. Knock yourself out.

http://stokumine.s3.amazonaws.com/ipinfodb_one_table_small_pgsql.sql.gz

to use:

psql -U[your_user] [your_db] < ipinfodb_one_table_small_pgsql.sql

creates a table called geo_ips

  • http://ipinfodb.com Marc-Andre Caron

    I finally released a PostgreSQL version…

  • http://www.tokumine.com simon

    Great Marc-Andre, Thanks!

  • http://www.vizzuality.com Javier de la Torre

    And if you later want to use this table, here is an example SQL statement:

    SELECT * FROM geo_ips where ip_start <= inetmi('74.125.45.100','0.0.0.0') order by ip_start desc limit 1;

  • http://www.tokumine.com simon

    Looks like the ipinfoDB PostgreSQL version has gone offline, so this still is a good one to get.

    Since posting this I’ve found a couple of native web server module implementations that read the maxmind ip database:

    Nginx: http://wiki.nginx.org/NginxHttpGeoIPModule.
    Apache: http://www.maxmind.com/app/mod_geoip

Previous post: Using Tolk with Google Translate

Next post: UN flag suitable for famfamfam icon set