PostgreSQL dblink avec nommée connexions

dblink ne semble pas fonctionner lorsque j'utilise un nom de connexion à un serveur distant ou sans nom de connexion et de déconnexion. Il fonctionne très bien si j'utilise une nouvelle connexion avec une chaîne de connexion dans dblink(). Il se connecte bien, mais ma connexion n'est pas disponible lorsque j'essaie de l'utiliser. Toutes les idées sur la façon de le faire fonctionner avec nommée connexions?

Sans nom avec connstr Fonctionne correctement:

SELECT testtable.*
FROM   dblink('dbname=testdb port=5432 host=192.168.1.1 user=usr password=pw'
             ,'SELECT * FROM testtable')
AS     testtable(testtable_id integer, testtable_name text);

Retourne: Deux colonnes comme prévu.

Nommé Ne fonctionne pas:

Connect:

SELECT dblink_connect('myconn'
           ,'dbname=testdb port=5432 host=192.168.1.1 user=usr password=pw');

Retourne: "OK"

Requête:

SELECT testtable.* FROM dblink('myconn', 'SELECT * FROM testtable')
AS     testtable(testtable_id integer, testtable_name text);

Retourne:

ERROR:  could not establish connection
DETAIL:  missing "=" after "myconn" in connection info string

********** Error **********

ERROR: could not establish connection
SQL state: 08001
Detail: missing "=" after "myconn" in connection info string

Déconnecter:

SELECT dblink_disconnect('myconn');

Retourne:

ERROR:  connection "myconn" not available

********** Error **********

ERROR: connection "myconn" not available
SQL state: 08003

Sans nom avec _connect et _disconnect Ne fonctionne pas:

Connect:

SELECT dblink_connect('dbname=testdb port=5432 host=192.168.1.1
                                               user=usr password=pw');

Retourne: "OK"

Requête:

SELECT testtable.* FROM dblink('SELECT * FROM testtable')
AS testtable(testtable_id integer, testtable_name text);

Retourne:

ERROR:  connection not available

********** Error **********

ERROR: connection not available
SQL state: 08003

Déconnecter:

SELECT dblink_disconnect();

Retourne:

ERROR:  connection not available

********** Error **********

ERROR: connection not available
SQL state: 08003

OriginalL'auteur bendiy | 2012-03-26