In my understanding of the database tables, the pair tl_from + tl_from_namespace shall always match the pair page_id + page_namespace, but it does not!
See https://quarry.wmflabs.org/query/34007
in dewiki_p there are (currently) 122 links with different pairs, (in enwiki_p the quarry take too long), in frwiki_p there are 80 such pairs, in eswiki_p is none, in itwiki_p there are 25 – did not check more
In dewiki I changed the page Thea_Schmidt-Keune and purged (with ?action=purge) Wolfgang_Häntsch, but this did not help (both can be seen on page 2 of the quarry output). In both pages, the template "Personendaten" has tl_from_namespace = 2 (which should be 0) and page_namespace = 0 (which is correct).
Effects which can be seen by the user: At the very end of this list, you see the following two entries:
https://de.wikipedia.org/w/index.php?title=Spezial:Linkliste/Vorlage:INSEE-ISO_3166-2&namespace=2&limit=500
Saint-Julien-sur-Reyssouze (Vorlageneinbindung) (← Links | bearbeiten)
Saint-Martin-de-Bavel (Vorlageneinbindung) (← Links | bearbeiten)
Both pages are in namespace 0, but are presented to the user in namespace 2
Effects for bots and scripts: Queries need to join the table page to retrieve the correct namespace, so queries get more complicated and the database server has more work to do.
Expected: Empty result for the following queries:
select distinct il_to, page_namespace as correct, il_from_namespace as wrong
from page inner join imagelinks
on page_id = il_from
and page_namespace <> il_from_namespace;
select distinct pl_namespace, pl_title, page_namespace as correct, pl_from_namespace as wrong
from page inner join pagelinks
on page_id = pl_from
and page_namespace <> pl_from_namespace;
select distinct tl_namespace, tl_title, page_namespace as correct, tl_from_namespace as wrong
from page inner join templatelinks
on page_id = tl_from
and page_namespace <> tl_from_namespace;