Using seq. objects with COPY FROM? - Mailing list pgsql-novice

From Shivin M
Subject Using seq. objects with COPY FROM?
Date
Msg-id 1773e4d70611200600k14a6ffe5nc58e60eccec88a75@mail.gmail.com
Whole thread Raw
Responses Re: Using seq. objects with COPY FROM?  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
List 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 by date:

Previous
From: "A. Kretschmer"
Date:
Subject: Re: Aggregate Functions
Next
From: "A. Kretschmer"
Date:
Subject: Re: Using seq. objects with COPY FROM?