Olá,

2010/4/13 Diogo Castro <[email protected]>

> Olá J,
>
> Muito legal seu blog, você poderia me dar um exemplo de como fazer a
> conexao com um usuário orelha ? Estou tentando conectar usando o
> dblink_connect_u, porém recebo o seguinte erro:
>
> ERROR: function dblink_connect_u(unknown, unknown) does not exist
> SQL state: 42883
> Hint: No function matches the given name and argument types. You might need
> to add explicit type casts.
> Character: 82
>

Acho que você não carregou as funções do dblink no banco que está fazendo a
conexão remota.

>
> -
> dblink_connect_u
> Namedblink_connect_u -- opens a persistent connection to a remote
> database, insecurely
> Synopsis
>
>     dblink_connect_u(text connstr) returns text
>
>     dblink_connect_u(text connname, text connstr) returns text
>
> Description
>
> dblink_connect_u() is identical to dblink_connect(), except that it will
> allow non-superusers to connect using any authentication method.
>
> If the remote server selects an authentication method that does not involve
> a password, then impersonation and subsequent escalation of privileges can
> occur, because the session will appear to have originated from the user as
> which the local PostgreSQL server runs. Therefore, dblink_connect_u() is
> initially installed with all privileges revoked from PUBLIC, making it
> un-callable except by superusers. In some situations it may be appropriate
> to grant EXECUTE permission for dblink_connect_u() to specific users who
> are considered trustworthy, but this should be done with care.
>
> For further details see dblink_connect().
>
>
> -
> ------------------------------
>
>
> Em 12 de abril de 2010 21:16, JotaComm <[email protected]> escreveu:
>
> Olá, Diogo
>>
>> 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);
>>>
>>> De uma olhada em meu blog, lá tem um exemplo de como utilizar o DBLink.
>>
>>
>>
>>> Em 12 de abril de 2010 16:35, Osvaldo Kussama <[email protected]
>>> > escreveu:
>>>
>>> Em 12 de abril de 2010 16:25, Diogo Castro <[email protected]> escreveu:
>>>> >
>>>> > Não fez a menor diferença colocar o orelha como trust no hba.
>>>> >
>>>> > Em 12 de abril de 2010 13:24, Joao Cosme de Oliveira Junior <
>>>> [email protected]> escreveu:
>>>> >>
>>>> >> tem q colocar o orelha como trust no pg_hba.conf  para o bd em
>>>> questao
>>>> >>
>>>> >>
>>>> >> João Cosme de Oliveira Júnior
>>>> >>
>>>> >>
>>>> >>
>>>> >> "Lembre-se que da conduta de cada um depende o destino de todos."
>>>> >>
>>>> >> Seja inteligente, use Software livre!!!
>>>> >> LPI Certified
>>>> >> LPI000185554
>>>> >>
>>>> >>
>>>> >> Em 12/04/2010 às 13:22 horas, 
>>>> >> [email protected]:
>>>> >>
>>>> >> Boa tarde,
>>>> >>
>>>> >> Sei que o DBLINK está ativo e funcional.
>>>> >>
>>>> >> Porém .. Se eu conectar com um usuário "orelha" ( que não é super
>>>> usuário ), a consulta retorna o seguinte erro ..
>>>> >>
>>>> >> ERROR:  password is required
>>>> >> DETAIL:  Non-superuser cannot connect if the server does not request
>>>> a password.
>>>> >> HINT:  Target server's authentication method must be changed.
>>>> >>
>>>> >>
>>>> >> ********** Error **********
>>>> >>
>>>> >> ERROR: password is required
>>>> >> SQL state: 2F003
>>>> >> Detail: Non-superuser cannot connect if the server does not request a
>>>> password.
>>>> >> Hint: Target server's authentication method must be changed.
>>>> >>
>>>> >> Pergunta: Como "liberar" os usuários "orelhas" para o DBLINK ?
>>>> >>
>>>>
>>>>
>>>> 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
>>>>
>>>> Osvaldo
>>>> _______________________________________________
>>>> pgbr-geral mailing list
>>>> [email protected]
>>>> https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral
>>>>
>>>
>>>
>>>
>>> --
>>> Diogo Castro - Dcc
>>> Engenheiro de Computação
>>> MSN: [email protected]
>>>
>>> _______________________________________________
>>> pgbr-geral mailing list
>>> [email protected]
>>> https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral
>>>
>>>
>>
>> []s
>> --
>> JotaComm
>> http://jotacomm.wordpress.com
>>
>> _______________________________________________
>> pgbr-geral mailing list
>> [email protected]
>> https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral
>>
>>
>
>
> --
> Diogo Castro - Dcc
> Engenheiro de Computação
> MSN: [email protected]
>
> _______________________________________________
> pgbr-geral mailing list
> [email protected]
> https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral
>
>

[]s
-- 
JotaComm
http://jotacomm.wordpress.com
_______________________________________________
pgbr-geral mailing list
[email protected]
https://listas.postgresql.org.br/cgi-bin/mailman/listinfo/pgbr-geral

Responder a