You have an error relating to an index or a TOAST table and want to know what the main relation associated with it is.
select indexrelid::regclass from pg_index where indexrelid = 'my_table_pkey'::regclass;
The reverse mapping is:
select indexrelid::regclass from pg_index where indrelid = 'my_table'::regclass;
You'll need superuser rights because pg_toast
isn't directly accessible by normal users.
select oid::regclass from pg_class where reltoastrelid = 'pg_toast.pg_toast_65536'::regclass;
The reverse mapping is:
select reltoastrelid::regclass from pg_class where oid = 'my_table'::regclass;