Ow Mun Heng wrote:
>>> In either of the above, I would like to know which one
>>> is able to help me to like connect to a remote DB, use the
>>> table there and join to a local table in PG so that I
>>> don't have to use DBI to pull and insert those data into
>>> the local PG database.
>>
>> Neither. To the best of my knowledge, there isn't anything
>> that will allow you to to do that.
>
> Ah.. Too bad.. There goes my "easy peasy life" out the window. But in
> any case, good to know.. dbi-link would be what I would want
> to try out.
True, you'll have to write some stuff that does something like:
- pull the data over from the other database
- replace the data in the local table
But I think that it does not matter if you use dblink or dbi-link
for that.
Since it is between PostgreSQL databases, I would probably prefer
dblink, because dbi-link is designed to work with ANY other database
that supports Perl::DBI and so preserves less of the PostgreSQL-ness
of the data - e.g. data type is lost, all data arrive as text.
Also, dbi-link has a more complicated architecture since it depends
on more things outside of PostgreSQL (naturally).
dbi-link is cool software though :^)
>>> BTW, dblink doesn't compile. (8.2.4)
>>>
>>> dblink.c:56:28: error: utils/fmgroids.h: No such file or directory
>
> BTW, this is gentoo and though I compiled it from source, the
> compiled tarballs are deleted.
>
> I did a configure in the PG source main dir and then proceeded to do a
> make in the contrib/dblink directory with above errors.
The correct way is like this:
cd into the PostgreSQL source directory
./configure with the correct arguments
make -C src/backend ../../src/include/utils/fmgroids.h
make -C contrib/dblink
Yours,
Laurenz Albe