Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dehwW-0004d3-68 for pgsql-bugs@arkaria.postgresql.org; Mon, 07 Aug 2017 13:19:36 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dehwV-0007d6-Os for pgsql-bugs@arkaria.postgresql.org; Mon, 07 Aug 2017 13:19:35 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dehwV-0007cx-FU for pgsql-bugs@postgresql.org; Mon, 07 Aug 2017 13:19:35 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dehwO-0005b6-KG for pgsql-bugs@postgresql.org; Mon, 07 Aug 2017 13:19:34 +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 v77DJQRo020777; Mon, 7 Aug 2017 09:19:26 -0400 From: Tom Lane To: Jaimin Pan cc: pgsql-bugs@postgresql.org Subject: Re: Error of insert Foreign table with postgres_fdw In-reply-to: References: Comments: In-reply-to Jaimin Pan message dated "Mon, 07 Aug 2017 15:45:16 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <20775.1502111966.1@sss.pgh.pa.us> Date: Mon, 07 Aug 2017 09:19:26 -0400 Message-ID: <20776.1502111966@sss.pgh.pa.us> List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Jaimin Pan writes: > I got error when insert a parent table by inserting a foreign table. > ... > (create trigger "phone_pool_insert_trigger" for phone_pool and insert into > phone_pool works well. The child table got the row.) > when insert into phone_pool_foreign. I got error like following. > ERROR: relation "ph_90" does not exist > CONTEXT: Remote SQL command: INSERT INTO public. phone_pool_foreign(id, > patrition, phone, carrier, createtime, updatetime, deleteflg) VALUES ($1, > $2, $3, $4, $5, $6, $7) > PL/pgSQL function public.phone_pool_insert_trigger() line 93 at SQL > statement > """ You didn't show us either the whole trigger or the failing statement in it, but I bet you forgot to schema-qualify the child table names. postgres_fdw runs the remote session with a very restrictive search_path, just pg_catalog if memory serves. It's generally bad practice for triggers to rely on the prevailing search path in any case. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs