select * from geoname where country = 'GB' order by random() LIMIT 1
Possibly confusion when the standard was devised, GB is short for Great Britain which is often confused with United Kingdom. When defining country top level domains, undid this mistake and switched to the more understandable .uk (.gb domains are not used)
allCountries data uses ISO 2 lett country codes (I'm guessing that's what you import into your PostgreSQL)
From countryInfo:
Code:
#ISO ISO3 ISO-Numeric fips Country Capital Area(in sq km) Population Continent tld CurrencyCode CurrencyName Phone Postal Code Format Postal Code Regex Languages geonameid neighbours EquivalentFipsCode
GB GBR 826 UK United Kingdom London 244820 62348447 EU .uk GBP Pound 44 @# #@@|@## #@@|@@# #@@|@@## #@@|@#@ #@@|@@#@ #@@|GIR0AA ^(([A-Z]\d{2}[A-Z]{2})|([A-Z]\d{3}[A-Z]{2})|([A-Z]{2}\d{2}[A-Z]{2})|([A-Z]{2}\d{3}[A-Z]{2})|([A-Z]\d[A-Z]\d[A-Z]{2})|([A-Z]{2}\d[A-Z]\d[A-Z]{2})|(GIR0AA))$ en-GB,cy-GB,gd 2635167 IE