inherited index check

Original query:

SELECT
	it.inhrelid::REGCLASS, indexrelid::REGCLASS, indisvalid, ii.inhrelid::REGCLASS
FROM
	pg_inherits AS it
	LEFT JOIN pg_index ON it.inhrelid = indrelid
	LEFT JOIN pg_inherits AS ii ON
			indexrelid = ii.inhrelid AND ii.inhparent = 'the_index'::REGCLASS
WHERE
	it.inhparent = 'the_table'::REGCLASS;