Re: Querying across databases - Mailing list pgsql-general

From Andrew Gould
Subject Re: Querying across databases
Date
Msg-id 20001016132345.10468.qmail@web122.yahoomail.com
Whole thread Raw
In response to Querying across databases  (Zak McGregor <zak@mighty.co.za>)
List 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@mighty.co.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/

pgsql-general by date:

Previous
From: Zak McGregor
Date:
Subject: Querying across databases
Next
From: Andrew Gould
Date:
Subject: Re: int8 vs text in odbc link