COPY from CSV, passing in default value?

Поиск
Список
Период
Сортировка
От adebarros
Тема COPY from CSV, passing in default value?
Дата
Msg-id 1337016663146-5708672.post@n5.nabble.com
обсуждение исходный текст
Ответы Re: COPY from CSV, passing in default value?  (François Beausoleil <francois@teksol.info>)
Re: COPY from CSV, passing in default value?  (Ben Madin <lists@remoteinformation.com.au>)
Список pgsql-general
Assuming I have a table structured like so:

CREATE TABLE salaries (
    Town varchar(30),
    County varchar(30),
    Supervisor varchar(30),
    StartDate date,
    Salary int,
    Benefits int
);

If I have a CSV with only three of those fields, I can import like this:

COPY salaries (Town, Supervisor, Salary)
FROM 'C:\salaries.csv'
WITH (FORMAT CSV);

However, what if I wanted to assign a default value during import to
populate the County field? In my dreams it would be something like this
(which does not work):

COPY salaries (Town, 'County Name', Supervisor, Salary)
FROM 'C:\salaries.csv'
WITH (FORMAT CSV);

Any ideas?

Thanks.


--
View this message in context:
http://postgresql.1045698.n5.nabble.com/COPY-from-CSV-passing-in-default-value-tp5708672.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.

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

Предыдущее
От: Paulo Correia
Дата:
Сообщение: Re: Postgres 9.0 Streaming Replication and Load Balancing?
Следующее
От: Kyle Lanclos
Дата:
Сообщение: Performance of PostgreSQL B+-tree algorithm