Using seq. objects with COPY FROM?

Поиск
Список
Период
Сортировка
От Shivin M
Тема Using seq. objects with COPY FROM?
Дата
Msg-id 1773e4d70611200600k14a6ffe5nc58e60eccec88a75@mail.gmail.com
обсуждение исходный текст
Ответы Re: Using seq. objects with COPY FROM?  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
Список pgsql-novice
Hello,
I was wondering whether you can make use of sequence objects along with COPY FROM command?

This is my scenario:

I have table: name_list(id SERIAL PRIMARY KEY, name varchar(10))

So, there exists a sequence object: "name_list_id_seq" that starts from 1.

I have a CSV file that has names of people.
eg:

name

tom
mary
harry

Now, I want to read this file into the table 'name_table', and at the same time, add sequence object's ("name_list_id_seq") next value to each row.
So, the contents of "name_table" now look like:

name_table
 
id  name
---  -------
1   tom
2   mary
3   harry

Can anyone tell me how this can be done?
Thank you.

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

Предыдущее
От: "A. Kretschmer"
Дата:
Сообщение: Re: Aggregate Functions
Следующее
От: "A. Kretschmer"
Дата:
Сообщение: Re: Using seq. objects with COPY FROM?