You need to download the OSM data you are interested in and load it to PostGIS using osm2pgsql. (not sure if you have already done this)
Then you just run the query:
select name from planet_osm_point where place in ('city','town','village');
The data is not guaranteed to be complete off course, because the labelling is done in a crowd-sourced way.