Skip site navigation (1) Skip section navigation (2)

How to remove quotes from COPY TO result?

From: Michael Rowan <mike(dot)rowan(at)internode(dot)on(dot)net>
To: postgresql novice <pgsql-novice(at)postgresql(dot)org>
Subject: How to remove quotes from COPY TO result?
Date: 2010-07-18 04:45:58
Message-ID: E10B9D5E-90CF-49D3-9C48-36CD9DD59F68@internode.on.net (view raw or flat)
Thread:
Lists: pgsql-novice
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?  

TIA

Michael Rowan
mike(dot)rowan(at)internode(dot)on(dot)net

11 Kingscote Street
ALBERTON
South Australia 5014

tel 618 8240 3993




Responses

pgsql-novice by date

Next:From: Joe ConwayDate: 2010-07-18 06:44:13
Subject: Re: How to remove quotes from COPY TO result?
Previous:From: Steve CrawfordDate: 2010-07-16 15:47:59
Subject: Re: Need help doing a CSV import

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group