pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jaimin Pan <jaimin.pan@gmail.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: Error of insert Foreign table with postgres_fdw
Date: Mon, 07 Aug 2017 09:19:26 -0400
Message-ID: <20776.1502111966@sss.pgh.pa.us> (raw)
In-Reply-To: <CABP8UDQ+vCLTjpjCiK0F=ykp7Rc3nXVUWsiYafqkrp=u4Ypzfg@mail.gmail.com>
References: <CABP8UDQ+vCLTjpjCiK0F=ykp7Rc3nXVUWsiYafqkrp=u4Ypzfg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Jaimin Pan <jaimin.pan@gmail.com> 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



view thread (3+ messages)  latest in thread

Message-ID: <20776.1502111966@sss.pgh.pa.us>
Permalink:  ../20776.1502111966@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/20776.1502111966@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, jaimin.pan@gmail.com
  Subject: Re: Error of insert Foreign table with postgres_fdw
  In-Reply-To: <20776.1502111966@sss.pgh.pa.us>
  References: <CABP8UDQ+vCLTjpjCiK0F=ykp7Rc3nXVUWsiYafqkrp=u4Ypzfg@mail.gmail.com> <20776.1502111966@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox