Selectively Importing Data

From: David Blomstrom <david(dot)blomstrom(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Selectively Importing Data
Date: 2015-10-31 00:24:13
Message-ID: CAA54Z0ju5m6D2MDiuaa-_dOttKQoNzrup_diKJ=OqQhGxT_Q+w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

First consider the following table:

create table taxon (
taxonid serial,
descr text
);

As I understand it, "serial" means that column will automatically populate
with a numerical key.

If I want to fill the field 'descr' with a list of scientific names stored
in a spreadsheet, then how would I proceed?

I have a spreadsheet that has about a dozen columns. I copied the field
with scientific names into a new spreadsheet. Then I created an empty field
on the left. So I have a spreadsheet with two columns. I saved it as a CSV
file.

When I try to import it with pgAdmin III, I get the error message

WARNING: null value in column "taxonid" violates non-null constraint

How can I import that single column into the second column in this table?
Thanks.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Stephen Davies 2015-10-31 01:43:09 Upgrade from 9.3 to 9.4 issue
Previous Message David Blomstrom 2015-10-30 23:38:00 Re: Hierarchical Query Question (PHP)