psql. This release was generated with PostgreSQL 16.15; use a compatible, supported server and client.
These instructions use v5.2.0-export.1, published 3 November 2026. Its core tables contain 250 countries, 5,327 states and 156,169 city records. API data and installed package snapshots can differ. Check the latest release before choosing another version.
Download the release
Run these POSIX-shell commands in a new directory. Downloads are compressed; extract them before opening or importing.Import into a new database
Use your database role in place ofpostgres. Create a new database first; do not run the import against a database containing application data.
ON_ERROR_STOP makes an import error stop the client instead of allowing later statements to hide it. If an import fails, investigate it before retrying in another new database.
Verify the import
\dt public.* and \d public.cities in psql to inspect the imported schema.
Query the hierarchy
Names of parent places are joined from their tables.cities does not store country_name or state_name; use a left join for nullable state links.
Troubleshooting
- Confirm that you selected the export for your database engine; SQL dialects are not interchangeable.
- Check the release tag and source files when counts differ. Counts from an API or a package can describe another snapshot.
- Inspect the actual table definitions before selecting columns. See the schema reference.