From: | Michael Rowan <mike(dot)rowan(at)internode(dot)on(dot)net> |
---|---|
To: | postgresql novice <pgsql-novice(at)postgresql(dot)org> |
Subject: | Re: How to remove quotes from COPY TO result? |
Date: | 2010-07-18 09:00:48 |
Message-ID: | 9A757802-CD40-4816-A2C8-62E3B0A69015@internode.on.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
Thanks Joe. That works fine, but gave me a hint to use the escape string syntax for escapes e.g., E'\r\n'.
I will attempt to discover what that means ;-)
Thanks again
Mike
On 18/07/2010, at 4:14 PM, Joe Conway wrote:
> On 07/17/2010 09:45 PM, Michael Rowan wrote:
>> PostgreSQL 8.4.1
>>
>> I have a table "abbreviation" created as follows:
>>
>> id serial NOT NULL, full_name character varying(16), short_name
>> character varying(16),
>>
>> I import some data from a tab delimited text file like so:
>>
>> 1 "STREET" "ST" 2 "ROAD" "RD"
>>
>> using COPY abbreviation FROM <<myfile>>
>>
>> The data is imported but I want the character columns to be stripped
>> of the enclosing double-quotes and they are not. What do I have to
>> do?
>
> See:
> http://www.postgresql.org/docs/8.4/interactive/sql-copy.html
>
> COPY abbreviation FROM 'filename' WITH DELIMITER '\t' CSV;
> select * from abbreviation;
> id | full_name | short_name
> ----+-----------+------------
> 1 | STREET | ST
> 2 | ROAD | RD
> (2 rows)
>
> HTH,
>
> Joe
>
> --
> Joe Conway
> credativ LLC: http://www.credativ.us
> Linux, PostgreSQL, and general Open Source
> Training, Service, Consulting, & 24x7 Support
>
Michael Rowan
mike(dot)rowan(at)internode(dot)on(dot)net
11 Kingscote Street
ALBERTON
South Australia 5014
tel 618 8240 3993
From | Date | Subject | |
---|---|---|---|
Next Message | Joe Conway | 2010-07-18 16:06:49 | Re: How to remove quotes from COPY TO result? |
Previous Message | Joe Conway | 2010-07-18 06:44:13 | Re: How to remove quotes from COPY TO result? |