2025-03-01     2025-03-02     2025-03-03

countries as children in hierarchy also as iso country code in cc2

number of errors=0
number of warnings=0
Group=chkGrpHierarchy

select p.geonameid,p.name,p.featurecode,p.cc2,c.geonameid,c.name,c.featurecode,c.countrycode from geoname p, geoname c, geoname_hierarchy h where c.geonameid=childid and p.geonameid=parentid and p.featurecode='RGN' and (c.featurecode like 'ADM%' or c.featurecode in ('RGN')) and coalesce(p.cc2,'') not like '%' || c.countrycode || '%' and coalesce(p.countrycode,'') <> c.countrycode

select string_agg(countrycode,',') from (select distinct b.countrycode from geoname a, geoname b, geoname_hierarchy where a.geonameid=parentid and b.geonameid=childid and a.geonameid=xxxxxxx order by 1) as s;

geonameid	name	featurecode	cc2	geonameid	name	featurecode	countrycode