2015-12-30 8:16 GMT-03:00 Antonio Cesar <[email protected]>: > Bom dia pessoal > Estou tentando implementar a rotina no sistema mas deparai com o seguinte > problema: > dbamc001 - servidor1 > dbamc001 - servidor2 > > tabela cidade > como diferenciar a tabela do servidor1 um para o servidor2 > > CREATE EXTENSION hstore; > CREATE EXTENSION postgres_fdw; > > CREATE SERVER fdwamc001 FOREIGN DATA WRAPPER postgres_fdw OPTIONS (host > 'amcsistema.ddns.com.br', dbname 'dbamc001', port '5432'); > CREATE USER MAPPING FOR amcsistema SERVER fdwamc001 OPTIONS (user > 'amcsistema', password 'amc@31200676'); > > CREATE FOREIGN TABLE cidade2 (codigo INTEGER, nome VARCHAR(30) NOT NULL) > SERVER fdwamc001;
Quando criar a FOREIGN TABLE, utilize OPTIONS para definir o nome da tabela no servidor remoto. Exemplo: CREATE FOREIGN TABLE cidade2 (codigo INTEGER, nome VARCHAR(30) NOT NULL) SERVER fdwamc001 OPTIONS (schema_name 'public', table_name 'cidade'); Mais detalhes na documentação [1] > > select * from cidade2 > > > ERROR: relation "public.cidade2" does not exist > CONTEXT: Remote SQL command: SELECT codigo, nome FROM public.cidade2 > (execution time: 437 ms; total time: 437 ms) > > > _______________________________________________ > pgbr-geral mailing list > [email protected] > https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral [1] http://www.postgresql.org/docs/9.4/static/postgres-fdw.html _______________________________________________ pgbr-geral mailing list [email protected] https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral
