Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 14D6E475820 for ; Tue, 6 Aug 2002 12:11:06 -0400 (EDT) Received: from beamish.nsd.ca (unknown [205.150.156.194]) by postgresql.org (Postfix) with ESMTP id 5B65A475813 for ; Tue, 6 Aug 2002 12:11:05 -0400 (EDT) Received: (from smap@localhost) by beamish.nsd.ca (8.9.3/8.9.3) id MAA22396; Tue, 6 Aug 2002 12:11:05 -0400 X-Authentication-Warning: beamish.nsd.ca: smap set sender to using -f Received: from reddog.nsd.ca(192.168.101.30) by beamish.nsd.ca via smap (V2.1/2.1+anti-relay+anti-spam) id xma022394; Tue, 6 Aug 02 12:11:01 -0400 Received: from nsd.ca (jllachan-linux.nsd.ca [192.168.101.148]) by reddog.nsd.ca (8.8.7/8.8.7) with ESMTP id MAA03881; Tue, 6 Aug 2002 12:11:01 -0400 Message-ID: <3D4FF733.3D6F418D@nsd.ca> Date: Tue, 06 Aug 2002 12:20:03 -0400 From: Jean-Luc Lachance X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.4.9-31 i686) X-Accept-Language: en MIME-Version: 1.0 To: Jeff Eckermann Cc: John Zhang , pgsql-sql@postgresql.org Subject: Re: copy files to postgresql References: <20020806132325.38254.qmail@web20809.mail.yahoo.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200208/96 X-Sequence-Number: 8942 A much simpler solution would be to: create a table from the original one without the missing fields; use the copy command to import the file; insert into the original table from the new table, supplying null for the missing fields. JLL Jeff Eckermann wrote: > > I believe that soon-to-be-released version 7.3 will > have the ability to import data to specific columns, > as you are trying to do. For now, you will have to > edit your input file to insert values (even if null) > for the missing columns. The default null > representation expected by COPY is "\N" (backslash, > upper case "N"), or you can specify another using the > syntax "\copy .... with null as 'whatever'" > > --- John Zhang wrote: > > I was trying to copy files to columns of a > > PostgreSQL database table using \copy > > ( e. g. \copy mytable (column names here) from 'my > > file' using delimiters '\t'). > > PostgreSQL does not seem to like the column names > > part. Could someone help me > > with that? Thanks. > > > Put the text of the welcome message here. > > > > > ---------------------------(end of > > broadcast)--------------------------- > > TIP 4: Don't 'kill -9' the postmaster > > > > __________________________________________________ > Do You Yahoo!? > Yahoo! Health - Feel better, live better > http://health.yahoo.com > > ---------------------------(end of broadcast)--------------------------- > TIP 3: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly