=?utf-8?q?PG_Bug_reporting_form?= <noreply@postgresql.org> writes:
> I got an "ERROR: cache lookup failed for type 2" when a function is run for
> the first time in a session.
That certainly looks like a bug, but I can't replicate it from the
given instructions.
The function seems to expect that the current schema contains some
foreign key constraints, which it doesn't when I just follow your
script exactly. However, even if I add a few more tables with
foreign-key relationships, all seems well.
Please provide a complete script that will reproduce the problem
starting from an empty database. Also, have you got any extensions
loaded, or any unusual configuration settings?
regards, tom lane