Em 12 de abril de 2010 17:17, Diogo Castro <[email protected]> escreveu:
> Eis o código
>
> SELECT lotacao.id, lotacao.idcomarca, lotacao.descricao, lotacao.comarca,
> lotacao.matricula
>    FROM dblink('host=xxx dbname=dbsgj user=xxx password=xxx'::text, 'select
> lotacao.id, lotacao.comarca as idcomarca, lotacao.descricao,
> comarca.descricao as comarca, magistrados.matricula from lotacao
>          inner join comarca on lotacao.comarca = comarca.id
>          left join magistrados on lotacao.fk_magistrados_titular =
> magistrados.id
>   WHERE lotacao.ativa'::text) lotacao(id integer, idcomarca integer,
> descricao text, comarca character varying, matricula character varying);
>
> Em 12 de abril de 2010 16:35, Osvaldo Kussama <[email protected]>
> escreveu:
>>
>> Você não colocou qual comando de conexão está utilizando. Presumindo
>> que seja dblink_connect veja o que diz o manual;
>> "Notes
>>
>> Only superusers may use dblink_connect to create
>> non-password-authenticated connections. If non-superusers need this
>> capability, use dblink_connect_u instead."
>>
>> http://www.postgresql.org/docs/current/interactive/contrib-dblink-connect.html
>>


Do manual:
http://www.postgresql.org/docs/current/interactive/contrib-dblink.html
"When two text arguments are given, the first one is first looked up
as a persistent connection's name; if found, the command is executed
on that connection. If not found, the first argument is treated as a
connection info string as for dblink_connect, and the indicated
connection is made just for the duration of this command."

Você precisa criar explicitamente a conexão utilizando a função
dblink_connect_u e depois utilizar a função dblink na forma:
dblink(text connname, text sql)

Osvaldo
_______________________________________________
pgbr-geral mailing list
[email protected]
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral

Responder a