Process for populating tables in new database

From: Rich Shepard <rshepard(at)appl-ecosys(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Process for populating tables in new database
Date: 2018-12-01 14:09:55
Message-ID: alpine.LNX.2.20.1812010606370.8748@salmo.appl-ecosys.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Gierth 2018-12-01 14:14:30 Re: Transition Tables doesn´t have OID
Previous Message Adrian Klaver 2018-12-01 14:02:38 Re: Transition Tables doesn´t have OID