Re: [BUGS] BUG #14738: ALTER SERVER for foregin servers not working

Поиск
Список
Период
Сортировка
От Amit Langote
Тема Re: [BUGS] BUG #14738: ALTER SERVER for foregin servers not working
Дата
Msg-id 76f1487a-6b8a-61a9-ebd9-8ff047d0ba94@lab.ntt.co.jp
обсуждение исходный текст
Ответ на Re: [BUGS] BUG #14738: ALTER SERVER for foregin servers not working  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: [BUGS] BUG #14738: ALTER SERVER for foregin servers not working  (Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>)
Список pgsql-bugs
On 2017/07/11 1:18, Tom Lane wrote:
> fcs1@poczta.onet.pl writes:
>> PostgreSQL version: 9.4.1
> 
>> Command like this doesn't take effect:
>> ALTER SERVER srw_egib_1
>>   OPTIONS (
>>     SET host 'localhost',
>>     SET port '5432',
>>     SET dbname 'gml2m1');
>> It changes definition of this server but tables connected to it are still
>> connected to previous definition of this server, for example:
> 
> It would help if you provided a concrete example of misbehavior rather
> than abstract claims.  However, I *think* this is something we fixed in
> 9.4.11.

Perhaps you are referring to the following item fixed in 9.4.11 [1]:

"Ensure that cached plans are invalidated by changes in foreign-table options"

ISTM, OP's problem is unrelated.  Steps to reproduce:

create extension postgres_fdw ;
create server s1 foreign data wrapper postgres_fdw options (dbname 'db1');
create server s2 foreign data wrapper postgres_fdw options (dbname 'db2');
create user mapping for current_user server s1;
create user mapping for current_user server s2;
create foreign table t1 (a int) server s1 options (table_name 't1');

-- in db1
create table t1 (a) as select 1;

-- in db2
create table t1 (a) as select 2;

-- back in the original database; t1's server s1 connected to db1
select * from t1;a
---1
(1 row)

-- make s1 point to db2
alter server s1 options (set dbname 'db2');

-- postgres_fdw will still connect to db1
select * from t1;a
---1
(1 row)

I think that's because postgres_fdw/connection.c keeps a cache of
connections and does not invalidate it upon pg_foreign_server and/or
pg_user_mapping changes.  I think we discussed the possibility of fixing
this back when the above-mentioned fix was being worked on [2], but it
went nowhere.

Thanks,
Amit

[1] https://www.postgresql.org/docs/devel/static/release-9-4-11.html
[2]
https://www.postgresql.org/message-id/20160405.184408.166437663.horiguchi.kyotaro%40lab.ntt.co.jp



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

В списке pgsql-bugs по дате отправления:

Предыдущее
От: "Peter J. Holzer"
Дата:
Сообщение: Re: [BUGS] [HACKERS] Postgres process invoking exit resulting insh-QUIT core
Следующее
От: Kyotaro HORIGUCHI
Дата:
Сообщение: Re: [BUGS] BUG #14738: ALTER SERVER for foregin servers not working