Re: two databases in one - Mailing list pgsql-admin

From Soulabaille Samantha
Subject Re: two databases in one
Date
Msg-id 44E32F66.2060600@sihpic.fr
Whole thread Raw
In response to Re: two databases in one  ("Ben K." <bkim@coe.tamu.edu>)
List pgsql-admin
Thanks for your response.

Indeed , the serials are used as foreign keys.

We made a web site with a database. Then we duplicated the web site and
the databse (without data, only schéma) for another server .
The 2 databases were filled in the same time.

Now someone would like to merge the 2 databases and have only 1 site and
1 database.
I was thinking about changing serials of the 2nd database and do a
restore on the 1st, as you said.
But it's a big database, and i'm not sure of the exactly things to do.



Ben K. a écrit :
>> I've got two databases with the same tables and schema on two
>> different servers.
>> I want to have only one database.
>> So i would like to insert in the first database the data of the
>> second database.
>> I don't know how to do this because almost of the tables contains
>> serial.
>> It's for production databases, i can't make mistakes.
>
> Maybe you could just import the second database into another schema of
> the first database if it's urgent...
>
> Otherwise the nature of conflicts will have to be thought through, like
>
> - Are there some data that exist in both databases - i.e. which become
> duplicates if both tables are merged?
>
> - Are the serials used as foreign keys in other tables or as the basis
> of any other fields?
>
> - Can the serials be changed to different numbers - e.g., is it ok or
> even needed to convert "11" on database B to "10011" on database A and
> so on, to avoid conflict two ID 11 records having different data?
>
> - Does the order of records matter?
>
>
> Once the problem is familiar, many gurus will be able to help. I just
> wanted to provide a starter.
>
>
> Regards,
>
>
> Ben K.
> Developer
> http://benix.tamu.edu
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
>       choose an index scan if your joining column's datatypes do not
>       match
>
>


Attachment

pgsql-admin by date:

Previous
From: Erika Terahata Torres Prada e Silva - MPS
Date:
Subject: Issue on Varchar Ordering
Next
From: "Jim Nasby"
Date:
Subject: Re: Restoring database question, part 2..