pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedError of insert Foreign table with postgres_fdw
3+ messages / 2 participants
[nested] [flat]
* Error of insert Foreign table with postgres_fdw
@ 2017-08-07 07:45 Jaimin Pan <jaimin.pan@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Jaimin Pan @ 2017-08-07 07:45 UTC (permalink / raw)
To: pgsql-bugs
Hi all,
I got error when insert a parent table by inserting a foreign table.
Environment is following:
PG 9.6.3
CentOS6
step 1.
database1: create one parent table: phone_pool, 100 inherits table: ph_xx.
phone_pool
ph_0
...
ph_99
(create trigger "phone_pool_insert_trigger" for phone_pool and insert into
phone_pool works well. The child table got the row.)
step 2:
database2:
create foreign table phone_pool_foreign for phone_pool in database1.
when insert into phone_pool_foreign. I got error like following.
"""
insert into
phone_pool_foreign(id,patrition,phone,carrier,createtime,updatetime,deleteflg)
SELECT
'35A88C4B06B3', '90', '133333330', '1', to_date('2017-08-07
11:57:33.398','yyyy-mm-dd hh24:mi:ss'), to_date('2017-08-07
11:57:33.398','yyyy-mm-dd hh24:mi:ss'), 1;
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
"""
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Error of insert Foreign table with postgres_fdw
@ 2017-08-07 13:19 Tom Lane <tgl@sss.pgh.pa.us>
parent: Jaimin Pan <jaimin.pan@gmail.com>
0 siblings, 1 reply; 3+ messages in thread
From: Tom Lane @ 2017-08-07 13:19 UTC (permalink / raw)
To: Jaimin Pan <jaimin.pan@gmail.com>; +Cc: pgsql-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
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Error of insert Foreign table with postgres_fdw
@ 2017-08-08 06:53 Jaimin Pan <jaimin.pan@gmail.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 3+ messages in thread
From: Jaimin Pan @ 2017-08-08 06:53 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-bugs
Thanks Tom. Add the schema "public" in trigger solve my question.
2017-08-07 21:19 GMT+08:00 Tom Lane <tgl@sss.pgh.pa.us>:
> 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
>
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2017-08-08 06:53 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-08-07 07:45 Error of insert Foreign table with postgres_fdw Jaimin Pan <jaimin.pan@gmail.com>
2017-08-07 13:19 ` Tom Lane <tgl@sss.pgh.pa.us>
2017-08-08 06:53 ` Jaimin Pan <jaimin.pan@gmail.com>
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