Re: How to remove quotes from COPY TO result?

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: Michael Rowan <mike(dot)rowan(at)internode(dot)on(dot)net>, postgresql novice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: How to remove quotes from COPY TO result?
Date: 2010-08-09 22:53:04
Message-ID: 201008092253.o79Mr4D16699@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Joe Conway wrote:
-- Start of PGP signed section.
> 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)

How were the double-quotes removed?

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Michael Wood 2010-08-10 09:58:25 Re: How to remove quotes from COPY TO result?
Previous Message Leon Starr 2010-08-09 18:16:00 How to access error message text in plpgsql