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.