As I’ve posted before, the download from the USGS Geonames site has some problems. The feature_id column should be unique, but it is not because the file contains some of the same feature names in Mexico and Canada with the same id which breaks the unique constraint.
I just added a very quick and dirty python program to my misc_gis_scripts repo on Github. It’s run by
python3 gnisfixer.py downloadedgnisfile newgnisfile
For the latest download, it removed over 7,000 non-US or US Territory entries and into the DB perfectly.