Re: help with COPY query

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Elinor Medezinski <elinor(at)bellatrix(dot)tau(dot)ac(dot)il>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: help with COPY query
Date: 2004-02-29 04:00:56
Message-ID: 12493.1078027256@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Elinor Medezinski <elinor(at)bellatrix(dot)tau(dot)ac(dot)il> writes:
> I want to load a file containning a column of FLOATS, into a table of
> INTEGERs.
> ...
> How can I go around this problem? is there any way to force copy to do the
> right casting?

COPY is not designed to do data manipulation for you. The best bet is
to load the data file into a temp table that has a column set matching
the data file, and then use INSERT ... SELECT to transform the data
and insert it into the final table.

regards, tom lane

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message V i s h a l Kashyap @ [Sai Hertz And Control Systems] 2004-02-29 06:07:11 Re: Cannot insert a duplicate key into unique index
Previous Message Bruce Momjian 2004-02-29 01:13:30 Re: Compilation issue with --enable-thread-safety