Just to clarify, my concern is about externally made databases, regardless
of whether these are imported directly into Wikidata, or have been
incorporated into Wikipedia first and imported into Wikidata from there.
For example, the population data in Wikipedia's list of ceremonial English
also features in the infoboxes of the articles on each county, would I
think be covered by database right under U.K law. Like other ONS material,
it has been made available under the OGL, which does impose some
obligations on re-users (somewhat similar to CC-BY).
I'm not so worried about databases originally generated within Wikipedia,
e.g. interwiki links. I think I agree with Gregor's analysis of these, if I
understand him correctly.
I'm no lawyer either. I'd be very happy to be told I'm wrong, that we have
had legal advice and there's no need to worry about licensing external data.