I have a table that should contain a unique list of values ('activityid') from the other tables in the database. I can generate the list of unique values, but when I try to add it to the table (which is empty to start with), PostgreSQL returns the error:
ERROR: null value in column "id" violates not-null constraint
This is my SQL query:
INSERT INTO catalog_activityid(activityid1)
SELECT distinct activityid from
(select activityid from d115ablackboxes
union select activityid from d115afilecabinets
union select activityid from d115arolledmaps
union select activityid from rockboxes1040)
as activityid
How can I have SQL add a value to the column 'id' at the same time as the INSERT command? Or, is there another workaround?