According to the DOC I can not do that. But fully recreate table force me to do huge work instead of simple:
ALTER FOREIGN TABLE table_name ALTER SERVER new_server_name;
According to the DOC I can not do that. But fully recreate table force me to do huge work instead of simple:
ALTER FOREIGN TABLE table_name ALTER SERVER new_server_name;
List your foreign data servers and note it oid:
select oid, * from pg_foreign_server
Find your foreign table:
select oid, * from pg_class where relkind = 'f'
Then modify system catalog pg_foreign_table
like:
update pg_foreign_table set ftserver = 11573931 where ftserver = 11573932 -- and ftrelid = YOUR_OID_RELID_FROM_PG_CLASS
In postgres 12 this command worked fine in order to change the server IP address that was used for foreign DB wrapper
alter server YOUR_SERVER_NAME options (set host 'XX.XXX.XX.X');
Don't change server using this way, because it will not update dependency table pg_depend and cause many problems later.