From: | Ondrej Ivanič <ondrej(dot)ivanic(at)gmail(dot)com> |
---|---|
To: | "pgsql-general(at)postgresql(dot)org general" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: How can I merge two tables? |
Date: | 2011-09-02 04:05:28 |
Message-ID: | CAM6mie+1OsycfWPBg=0EDoJ9bUKUCmyHL1CrH5+yHVEoK6QjTw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi,
On 2 September 2011 03:09, Jerry LeVan <jerry(dot)levan(at)gmail(dot)com> wrote:
> I keep registration numbers for software and login/passwords for
> various organizations, etc…
>
> As time goes by the tables on the various computers get out of
> sync.
>
> Is there an elegant way I can get all of the differences (uniquely)
I would copy data from the other machines to the "master" one:
on the "master", under postgres user (data only dump; -a options):
pg_dump -a -h <host1> -t registrations -U <user> <database> -F c |
pg_restore -d <database>
pg_dump -a -h <host2> -t registrations -U <user> <database> -F c |
pg_restore -d <database>
...
pg_dump -a -h <hostN> -t registrations -U <user> <database> -F c |
pg_restore -d <database>
and then do the following:
begin;
insert into tmp select distinct * from registrations;
truncate registrations;
insert into registrations select * from tmp;
commit;
--
Ondrej Ivanic
(ondrej(dot)ivanic(at)gmail(dot)com)
From | Date | Subject | |
---|---|---|---|
Next Message | Mike Christensen | 2011-09-02 04:12:59 | Re: pgAdmin3 not working with Gnome3 |
Previous Message | Diego Augusto Molina | 2011-09-02 03:54:07 | Re: How can I merge two tables? |