Maxim Gasumyants <m@gasumyants.com> writes:
> I am running latest release of PostgreSQL 12.
Are you certain it's the latest? This looks suspiciously like
some Var-numbering bugs we fixed a year or so ago.
I failed to reproduce any problem in 12.9 on the basis of the
info you supplied. I suppose that there might be some additional
conditions needed, like a dropped column in the parent table,
but experimentation didn't find it.
It might be useful to show the results of
select attname, attnum, attisdropped from pg_attribute
where attrelid = 'products_product_offers'::regclass and attnum > 0;
Also, if you can make a self-contained SQL script that exhibits
the problem for you, that would be very useful.
regards, tom lane