I use table prefixes on my dev wiki for this specific reason
reedy@ubuntu64-web-esxi:/var/www/wiki/mediawiki/core/extensionsgit/Oversight$ php migrateToRevDel.php
Migrating oversighted revisions to suppressed revisions. This will not add anything to recentchanges.
A database query error has occurred.
Query: SELECT hidden_page as page_id,hidden_namespace as page_namespace,hidden_title as page_title,hidden_page as rev_page,hidden_comment as rev_comment,hidden_user as rev_user,hidden_user_text as rev_user_text,hidden_timestamp as rev_timestamp,hidden_minor_edit as rev_minor_edit,hidden_deleted as rev_deleted,hidden_rev_id as rev_id,hidden_text_id as rev_text_id,0 as rev_len,hidden_by_user,hidden_on_timestamp,hidden_reason,user_name,0 as page_is_new,0 as rc_id,1 as rc_patrolled,0 as rc_old_len,0 as rc_new_len,0 as rc_params,NULL AS rc_log_action,0 AS rc_deleted,0 AS rc_logid,NULL AS rc_log_type,NULL AS rev_parent_id,hidden.* FROM mw_hidden INNER JOIN mw_user ON ((user.user_id = hidden.hidden_by_user)) WHERE (hidden.hidden_rev_id > '-1') ORDER BY hidden_rev_id LIMIT 20
Error: 1051 Unknown table 'hidden' (192.168.0.212)
$hiddenRows = $dbw->select( array( 'hidden', 'user' ), $selectFields, array( 'hidden.hidden_rev_id > ' . $dbw->addQuotes( $lastRevId ) ), __METHOD__, array( 'LIMIT' => $this->mBatchSize, 'ORDER BY' => 'hidden_rev_id' ), array( 'user' => array( 'INNER JOIN', 'user.user_id = hidden.hidden_by_user' ) ) );
There's at least 2 usages there (maybe more in the whole file) of tablename.col, that does break for hidden and user queries
Simplest fix might be to just alias the tables when selecting the tables