Re: Dataimport from remote db - Mailing list pgsql-novice

From Tom Lane
Subject Re: Dataimport from remote db
Date
Msg-id 3102.1215785416@sss.pgh.pa.us
Whole thread Raw
In response to Dataimport from remote db  ("Schoenit, Tobias AT/BHL-ZTPS" <tobias.schoenit@schaeffler.com>)
List pgsql-novice
"Schoenit, Tobias  AT/BHL-ZTPS" <tobias.schoenit@schaeffler.com> writes:
>         -- connect to remote database
>         PERFORM 'SELECT dblink_connect(''con'', v_constr);';
>         RAISE NOTICE 'connected';

>         FOR v_config in (SELECT * from  dblink('''con''',
> 'SELECT * from config ') AS

> But now I get:
> NOTICE:  connected

> ERROR:  could not establish connection
> DETAIL:  missing "=" after "'con'" in connection info string

You've got too many quotes in the second dblink call (as indeed the
error message shows, if you look carefully).

I'm also pretty sure that the first PERFORM isn't really establishing a
connection --- it looks to me like all it's doing is evaluating a
constant string.  You seem to be confused about the difference between
PERFORM and EXECUTE.  There is no need for EXECUTE here, so this
would be sufficient:
    PERFORM dblink_connect('con', v_constr);

            regards, tom lane

pgsql-novice by date:

Previous
From: "Wright, George"
Date:
Subject: Re: function source
Next
From: Mark Roberts
Date:
Subject: Re: Number of postgres connections