def check_foreign_keys(conn):
    """Check for foreign key errors.

    Return an iterator of rows with errors.
    """
    cur = conn.cursor()
    cur.execute('PRAGMA foreign_key_check')
    yield from cur
