Reputation: 505
insert into usertable (employeenumber) select empno from usertemp
And this is the error
ERROR: null value in column "id" violates not-null constraint
Upvotes: 0
Views: 847
Reputation: 48197
Just create your table using serial
, that will create the sequence and the default value
CREATE TABLE usertable (
id serial,
employeenumber integer
);
Insert should be the same
insert into usertable (employeenumber) select empno from usertemp
Upvotes: 1