Re: timestamp 'default' question - Mailing list pgsql-general

From Tom Lane
Subject Re: timestamp 'default' question
Date
Msg-id 9855.1047594222@sss.pgh.pa.us
Whole thread Raw
In response to timestamp 'default' question  (Charles Hauser <chauser@duke.edu>)
List pgsql-general
Charles Hauser <chauser@duke.edu> writes:
> When I attempt to load feature table w/out time entered ->
> psql:feature.stdin:1: ERROR:  copy: line 1, Missing data for column
> "timeaccessioned"

Well, yes, because your COPY command is claiming that all eleven columns
will be supplied in the input:

> COPY feature (feature_id, dbxref_id, organism_id, name, uniquename,
> residues, seqlen, md5checksum, type_id, timeaccessioned,
> timelastmodified) FROM stdin;
> 1       \N      133     scaffold_1      chlre01.1       AAATCCAAGC
> 376197  53adae6396a767c7e88910c73b9d0b6b        3
> \.

I think what you probably intend is

COPY feature (feature_id, dbxref_id, organism_id, name, uniquename,
residues, seqlen, md5checksum, type_id) FROM stdin;

which tells COPY to read those columns from the input and insert
defaults for the remaining columns.

            regards, tom lane

pgsql-general by date:

Previous
From: Joe Conway
Date:
Subject: Re: PL/Java (was: stored procedures)
Next
From: Jean-Luc Lachance
Date:
Subject: Re: Function in selection?