This is stated in the PostgreSQL documentation in the inheritance section. You can use the hidden tableoid table column along with relname from pg_class to add a column containing table names to the result, as shown below:
SELECT t.*, p.relname FROM table t, pg_class p WHERE t.tableoid = p.oid;
source share