Re: Process for populating tables in new database [RESOLVED] - Mailing list pgsql-general

From Rich Shepard
Subject Re: Process for populating tables in new database [RESOLVED]
Date
Msg-id alpine.LNX.2.20.1812010729220.8748@salmo.appl-ecosys.com
Whole thread Raw
In response to Re: Process for populating tables in new database  (Adrian Klaver <adrian.klaver@aklaver.com>)
List pgsql-general
On Sat, 1 Dec 2018, Adrian Klaver wrote:

> If you don't supply the key it will be generated as the default for the PK 
> column is a sequence.

   Thanks, Adrian. I thought this to be the case and did not find
confirmation in the manual (perhaps I just missed seeing it.)

> So are the tables you are INSERTing into currently unpopulated?

   Yes.

> In any case you will need to do this in sequence, where you populate the
> company table and then the contact table. The question is whether you want
> to pre-assign the company id's in the company data and the company_id_fk
> in the contacts data or not. If not then you will need to grab the company
> id's after populating the company table and match those to the contacts
> data before inserting it.

   This clears up everything. I'll let pg assign company id's then use them
as you write to relate the other tables to the proper company/contact.

Much appreciated,

Rich


pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Process for populating tables in new database
Next
From: Rich Shepard
Date:
Subject: Re: Process for populating tables in new database