BUG: fix checking of table name in read_sql (GH7826)