"Permission denied" in Postgres 12 trying to use to_regclass() on table partitions
The user that got the error does not have the USAGE permission on schema PUBLIC.
I recommend to grant that to everyone:
GRANT USAGE ON SCHEMA public TO PUBLIC;