create table osm_building as (select 1000000000+way id, geom,attributes->'building'
typeString,COALESCE(tagother->'name',tagother->'name:en'),tagOther->'addr:housenumber'
housenumber,tagOther->'addr:street' street,tagOther->'addr:city'
city,tagOther->'addr:state' state,tagOther->'addr:postcode'
postcode,tagOther->'addr:country' country,tagClass,tagOther,attributes from
osm_way w,osm_tag t where w.tagClass=t.tag and (attributes->'building') is not
null )

union

(select 10000000000+node id, geom, attributes->'building'
typeString,COALESCE(tagother->'name',tagother->'name:en'),tagOther->'addr:housenumber'
housenumber,tagOther->'addr:street' street,tagOther->'addr:city'
city,tagOther->'addr:state' state,tagOther->'addr:postcode'
postcode,tagOther->'addr:country' country,tagClass,tagOther,attributes from
osm_node n,osm_tag t where n.tagClass=t.tag and (attributes->'building') is
not null )

union

(select relation id, geom, attributes->'building'
typeString,COALESCE(tagother->'name',tagother->'name:en'),tagOther->'addr:housenumber'
housenumber,tagOther->'addr:street' street,tagOther->'addr:city'
city,tagOther->'addr:state' state,tagOther->'addr:postcode'
postcode,tagOther->'addr:country' country,tagClass,tagOther,attributes from
osm_relation r,osm_tag t where r.tagClass=t.tag and (attributes->'building') is
not null )
;
