I’m currently working on an e-commerce project after my regular job, and needed a batch list of countries, US states and Canadian provinces to prepopulate <select> fields. While Ubercart has one of the more complete implementations on their contributions page, I’m not running Drupal for this application and didn’t feel like reverse-engineering the CIF uploads to work with my much less enraging database. I just wanted some .csv or .tsv files that I could import into PostgreSQL.
The countries file is modified from the Country List with ISO Codes file at Text Fixer, and is a tab-separated value file. phpPgAdmin reads this properly. Change the header columns from ‘code’ and ‘name’ to your preferred table columns, and go ahead.
The states and provinces files are comma-separated values, and have the same ‘code’ and ‘name’ column headers. The states file was from this blog, which is down at the time of posting but Google has a reasonable cache of the particular page of interest. provinces.csv was compiled by myself.