From: | Paul Lambert <paul(dot)lambert(at)autoledgers(dot)com(dot)au> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Issue with copying data from a text file. |
Date: | 2007-03-20 02:25:38 |
Message-ID: | 45FF4622.2010404@autoledgers.com.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
I have a procedure in place that copies data from a caret delimited text
file into a table storing some information.
One of the fields in the table contains an item description which may
contain item dimensions such as - 17" alloy wheels
The problem I am getting when I do my load is I believe due to the
presence of the double quotation marks giving the copy the impression
that it is to include the information following as a single text string
until it gets to the next set of double quotes. As a result, I get the
following:
AutoDRS=# COPY deal_lines_temp_load FROM
'c:/temp/autodrs_deal_lines.txt'
WITH DELIMITER AS '^' CSV HEADER;
ERROR: value too long for type character varying(30)
CONTEXT: COPY deal_lines_temp_load, line 87, column order_desc: "17 5
spoke alloy wheels.^1291.18^117.38^983.69^1291.18^^C^^
The column as you can see is defined as a 30 character field, the load
contains in this column ^17" 5 spoke alloy wheels.^
I note an option in the COPY command to specify the quote character,
defaulting to double quote. The problem being a single quote will also
be used in the data, as will other characters. Is there any way to get a
copy to have no quote character? I.e. read the file and put whatever is
between the caret characters straight into the appropriate field exactly
as is.
TIA,
Paul.
--
Paul Lambert
Database Administrator
AutoLedgers
From | Date | Subject | |
---|---|---|---|
Next Message | Phillip Smith | 2007-03-20 02:37:16 | Re: Issue with copying data from a text file. |
Previous Message | Martin Marques | 2007-03-19 22:00:21 | Re: triple self-join crawling |