Re: Querying across databases

From: Andrew Gould <andrewgould(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Querying across databases
Date: 2000-10-16 13:23:45
Message-ID: 20001016132345.10468.qmail@web122.yahoomail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Zak,

One option to move data from table a (ta)in database 1
(db1) to database 2 (db2) is to create ta in db2 and
run the following from the shell:

psql -c "copy ta to stdout;" db1 | psql -c "copy ta
from stdin;" db2

Of course, this is a simplistic solution that assumes
that data will be added but not changed. I'm not sure
how to tell Postgres to replace unique records with
the newer values.

I'm sure other/better solutions will be posted by more
experienced users.

Best of luck,

Andrew

--- Zak McGregor <zak(at)mighty(dot)co(dot)za> wrote:
> Hi all
>
> Does anyone know if there any way that I can
> combine tables from 2
> databases into one query, or otherwise duplicate the
> contents (read-only
> is fine) of a table in another database? All the
> databases are on the same
> machine and being connected to from localhost.
>
> Any help at all would be very much appreciated.
>
> Thanks
>
>
====================================================================
> Zak McGregor
>
--------------------------------------------------------------------
> Of course my password is the same as my pet's name.
>
> My macaw's name was Q47pY!3, but I change it every
> 90 days.
>
====================================================================
>

__________________________________________________
Do You Yahoo!?
Yahoo! Messenger - Talk while you surf! It's FREE.
http://im.yahoo.com/

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Gould 2000-10-16 13:35:13 Re: int8 vs text in odbc link
Previous Message Zak McGregor 2000-10-16 11:19:11 Querying across databases