Unexpected result from PostgreSQL information schema
The only reason I can think of, is if my_schema is not part of your search_path.
As you pass a table name without schema qualifying it to the function pg_relation_size() the table is searched in the default search_path. If it's not found, you'll get that error.
Use a fully qualified name instead:
pg_relation_size(format('%I.%I', table_schema, table_name))