Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gT5z4-000174-Gf for pgsql-general@arkaria.postgresql.org; Sat, 01 Dec 2018 14:11:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1gT5y4-000552-Cf for pgsql-general@arkaria.postgresql.org; Sat, 01 Dec 2018 14:10:00 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gT5y4-000535-1N for pgsql-general@lists.postgresql.org; Sat, 01 Dec 2018 14:10:00 +0000 Received: from mail.appl-ecosys.com ([50.126.108.78]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gT5y1-0006J9-9W for pgsql-general@postgresql.org; Sat, 01 Dec 2018 14:09:58 +0000 Received: from salmo.appl-ecosys.com (salmo.appl-ecosys.com [192.168.55.1]) by mail.appl-ecosys.com (Postfix) with ESMTP id 9A6C5992EE for ; Sat, 1 Dec 2018 06:09:55 -0800 (PST) Date: Sat, 1 Dec 2018 06:09:55 -0800 (PST) From: Rich Shepard Reply-To: Rich Shepard To: pgsql-general@postgresql.org Subject: Process for populating tables in new database Message-ID: User-Agent: Alpine 2.20 (LNX 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I have a new database with five tables, and text files with data to populate the tables using the insert command. 1. Each table has a sequential primary key. Should I manually add keys to each insert row or will postgres generate it automatically? Example, for the companies table: org_id | integer | | not null | nextval('companies_org_id_seq'::regclass) org_name | character varying(64) | | not null | 2. Should I use sepatate files as input to each table or can I combine them in a single file? For example, adding a company name and contact name for someone in that company using input commands for both tables in a single file? I will need to provide the primary key to the company table as the foreign key in contact table and have not before pupulated multiple related tables in a new database from .sql files. TIA, Rich