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

From Ron
Subject Re: Bulk inserts into two (related) tables
Date
Msg-id d45c7a22-16f8-8997-28da-5e95b98f0984@gmail.com
Whole thread Raw
In response to Re: Bulk inserts into two (related) tables  (Rich Shepard <rshepard@appl-ecosys.com>)
List pgsql-general
On 5/21/19 12:27 PM, Rich Shepard wrote:
> On Tue, 21 May 2019, Michael Lewis wrote:
>
>> For each row-
>> Insert into organizations table if the record does not exist, returning ID.
>> Insert into people using that ID.
>
> Michael,
>
> The org_id will not exist until I run the insert script.
>
>> Else, load all the data with empty ID column on person table,then just
>> update the person table afterward and drop the org name column.
>
> Then I'll copy the org_id numbers to the appropriate row(s) in the people
> table.

A Perl/Python/etc script would solve your problem.

-- 
Angular momentum makes the world go 'round.



pgsql-general by date:

Previous
From: Fabrízio de Royes Mello
Date:
Subject: Re: Re: Refresh Publication takes hours and doesn´t finish
Next
From: Will Hartung
Date:
Subject: Re: Bulk inserts into two (related) tables