Re: How to remove quotes from COPY TO result?

Поиск
Список
Период
Сортировка
От Joe Conway
Тема Re: How to remove quotes from COPY TO result?
Дата
Msg-id 4C42A2BD.30809@joeconway.com
обсуждение исходный текст
Ответ на How to remove quotes from COPY TO result?  (Michael Rowan <mike.rowan@internode.on.net>)
Ответы Re: How to remove quotes from COPY TO result?  (Michael Rowan <mike.rowan@internode.on.net>)
Re: How to remove quotes from COPY TO result?  (Bruce Momjian <bruce@momjian.us>)
Список pgsql-novice
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


Вложения

В списке pgsql-novice по дате отправления:

Предыдущее
От: Michael Rowan
Дата:
Сообщение: How to remove quotes from COPY TO result?
Следующее
От: Michael Rowan
Дата:
Сообщение: Re: How to remove quotes from COPY TO result?