Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gXu5n-0007eG-ON for pgsql-bugs@arkaria.postgresql.org; Fri, 14 Dec 2018 20:29:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gXu5l-0007nQ-Qf for pgsql-bugs@arkaria.postgresql.org; Fri, 14 Dec 2018 20:29:49 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gXu2f-00023h-LY for pgsql-bugs@lists.postgresql.org; Fri, 14 Dec 2018 20:26:37 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gXu2d-0006k3-1l for pgsql-bugs@lists.postgresql.org; Fri, 14 Dec 2018 20:26:37 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id wBEKQUX3023951; Fri, 14 Dec 2018 15:26:30 -0500 From: Tom Lane To: jm.lessard@contactft.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #15553: "ERROR: cache lookup failed for type 2" with a function the first time it run. In-reply-to: <15553-a9453b116f1e3c75@postgresql.org> References: <15553-a9453b116f1e3c75@postgresql.org> Comments: In-reply-to =?utf-8?q?PG_Bug_reporting_form?= message dated "Fri, 14 Dec 2018 19:31:28 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <23949.1544819190.1@sss.pgh.pa.us> Date: Fri, 14 Dec 2018 15:26:30 -0500 Message-ID: <23950.1544819190@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk =?utf-8?q?PG_Bug_reporting_form?= 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