R
R
raiboon2014-12-03 18:24:18
PostgreSQL
raiboon, 2014-12-03 18:24:18

How to resolve db_link?

On the test everything was created from the root, there were no problems. I don't understand how to set up data retrieval via db_link.
If you just make a request - SELECT * FROM dblink('dbname=tbl', '...');then


18:20:34 Kernel error: ERROR: password is required
DETAIL: Non-superuser cannot connect if the server does not request a password.

If add
SELECT * FROM dblink('dbname=db user=user password=pwd', '...')
- same error, strange.
If a
GRANT EXECUTE ON FUNCTION dblink_connect_u(TEXT, TEXT) TO user;
, and then
SELECT dblink_connect_u('c', 'dbname=db');
SELECT * FROM dblink('c', '...')
- the first time is fine. And then
18:24:03 Kernel error: ERROR: duplicate connection name
.
So what's right?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question