I have a table 'new_table' with sequence id as primary key. how can I insert new records to it with data from other table. I tried:
insert into new_table (
(select (select NEXTVAL('my_sequence')),a,b,c from old_table)
);
but got
duplicate key value violates unique constraint DETAIL: Key (id)=(...) already exists.
insert into new_table ( a, b, c) select a,b,c from old_table;