Re: help with COPY query - Mailing list pgsql-novice

From Tom Lane
Subject Re: help with COPY query
Date
Msg-id 12493.1078027256@sss.pgh.pa.us
Whole thread Raw
In response to help with COPY query  (Elinor Medezinski <elinor@bellatrix.tau.ac.il>)
List pgsql-novice
Elinor Medezinski <elinor@bellatrix.tau.ac.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

pgsql-novice by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Compilation issue with --enable-thread-safety
Next
From: "V i s h a l Kashyap @ [Sai Hertz And Control Systems]"
Date:
Subject: Re: Cannot insert a duplicate key into unique index