pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rich Shepard <rshepard@appl-ecosys.com>
To: pgsql-general@postgresql.org
Subject: Process for populating tables in new database
Date: Sat, 1 Dec 2018 06:09:55 -0800 (PST)
Message-ID: <alpine.LNX.2.20.1812010606370.8748@salmo.appl-ecosys.com> (raw)

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








view thread (5+ messages)  latest in thread

Message-ID: <alpine.LNX.2.20.1812010606370.8748@salmo.appl-ecosys.com>
Permalink:  ../alpine.LNX.2.20.1812010606370.8748@salmo.appl-ecosys.com/
Also on:    postgresql.org/message-id/alpine.LNX.2.20.1812010606370.8748@salmo.appl-ecosys.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: rshepard@appl-ecosys.com
  Subject: Re: Process for populating tables in new database
  In-Reply-To: <alpine.LNX.2.20.1812010606370.8748@salmo.appl-ecosys.com>
  References: <alpine.LNX.2.20.1812010606370.8748@salmo.appl-ecosys.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox