Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 506A04763CD for ; Wed, 11 Dec 2002 04:58:09 -0500 (EST) Received: from anchor-post-39.mail.demon.net (anchor-post-39.mail.demon.net [194.217.242.80]) by postgresql.org (Postfix) with ESMTP id C46804761DB for ; Wed, 11 Dec 2002 04:58:08 -0500 (EST) Received: from mwynhau.demon.co.uk ([193.237.186.96] helo=mainbox.archonet.com) by anchor-post-39.mail.demon.net with esmtp (Exim 3.36 #2) id 18M3d3-00079R-0U; Wed, 11 Dec 2002 09:58:10 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by mainbox.archonet.com (Postfix) with ESMTP id 4B53217E69; Wed, 11 Dec 2002 09:58:08 +0000 (GMT) Received: from client.archonet.com (client.archonet.com [192.168.1.16]) by mainbox.archonet.com (Postfix) with ESMTP id A3FE716855; Wed, 11 Dec 2002 09:58:07 +0000 (GMT) Content-Type: text/plain; charset="utf-8" From: Richard Huxton Organization: Archonet Ltd To: Charles Hauser , PSQL_list Subject: Re: Adding foreign key constraint post table creation Date: Wed, 11 Dec 2002 09:58:07 +0000 User-Agent: KMail/1.4.3 References: <1039450281.32471.44.camel@pandorina.biology.duke.edu> In-Reply-To: <1039450281.32471.44.camel@pandorina.biology.duke.edu> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200212110958.07110.dev@archonet.com> X-Virus-Scanned: by AMaViS snapshot-20020531 X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200212/122 X-Sequence-Number: 10710 On Monday 09 Dec 2002 4:11 pm, Charles Hauser wrote: > All, > > A couple of novice questions: > > > I would like to modify an existing TABLE by addinga new column (FOREIGN > KEY): > > type_id int not null, > foreign key (type_id) references cvterm (cvterm_id), > > > Will this work ( running PostgreSQL 7.1.3 on i686-pc-linux-gnu, compiled > by GCC 2.96): You'll need to check your manuals for 7.1.3 - look in the SQL command=20 reference under ALTER TABLE. It should work with current versions but I don= 't=20 have v7.1.3 to hand. > I would like to load data into the table below from a file lacking the > timestamp fields, where the file structure is: > > COPY table FROM STDIN; > 1 feature_type types of features \N > 2 3'-exon \N 1 > > This fails as the timestamp fields are 'not null'. Othere than > generating INSERT stmts for the data how else could I enter the data? You could process the file with perl/awk etc. and add the required timestam= ps.=20 I don't think COPY substitutes default values for you. --=20 Richard Huxton