Re: Process for populating tables in new database [RESOLVED]

From: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Process for populating tables in new database [RESOLVED]
Date: 2018-12-01 15:32:27
Message-ID: alpine.LNX.2.20.1812010729220.8748@salmo.appl-ecosys.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Rich Shepard 2018-12-01 15:33:17 Re: Process for populating tables in new database
Previous Message Adrian Klaver 2018-12-01 14:40:01 Re: Process for populating tables in new database