Re: Bulk inserts into two (related) tables - Mailing list pgsql-general

From Francisco Olarte
Subject Re: Bulk inserts into two (related) tables
Date
Msg-id CA+bJJbwjTGmnTw55gvjbeNfutPY1Z-PsXoz_f7ycLDGac2SPxA@mail.gmail.com
Whole thread Raw
In response to Re: Bulk inserts into two (related) tables  (Rich Shepard <rshepard@appl-ecosys.com>)
Responses Re: Bulk inserts into two (related) tables
List pgsql-general
On Tue, May 21, 2019 at 7:24 PM Rich Shepard <rshepard@appl-ecosys.com> wrote:
> > From how you say it, I assume you have some data in your original
> > dumps which can relate boths, lets assume it's org_name, but may be an
> > org-code. If you do not have it it means you cannot match people to
> > orgs in your data, all is lost.
> Not yet with these new data.
> I'll manually insert the org_id numbers from the organizations table into
> the people table.

I'm curious, what org_id do you put (manually) to the people? you must
have some way to match it ( like, say, "I have an organization line,
followed by lines for people in this organization"

Because if you cannot match them by hand, the Db is not going to be of use.

Knowing how you know the org for a people is crucial for a solution (
i.e., for the previous example I'll just add a synthetic org_code line
to each one and do the to temp tables trick for a long file, or, just
advance the sequence (if needed manually ( to reserve org_id )) and
them do a perl one liner to augment the data ( but I've been perling
since the 4.019 times, so this may not be as easy for others ).

Francisco Olarte.



pgsql-general by date:

Previous
From: Fabio Ugo Venchiarutti
Date:
Subject: Re: distinguish update from insert (on conflict)
Next
From: Francisco Olarte
Date:
Subject: Re: Bulk inserts into two (related) tables