Re: How can I merge two tables?
От | Ondrej Ivanič |
---|---|
Тема | Re: How can I merge two tables? |
Дата | |
Msg-id | CAM6mie+1OsycfWPBg=0EDoJ9bUKUCmyHL1CrH5+yHVEoK6QjTw@mail.gmail.com обсуждение исходный текст |
Ответ на | How can I merge two tables? (Jerry LeVan <jerry.levan@gmail.com>) |
Список | pgsql-general |
Hi, On 2 September 2011 03:09, Jerry LeVan <jerry.levan@gmail.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.ivanic@gmail.com)
В списке pgsql-general по дате отправления: