Reputation: 1617
I have two tables: the first table, customer_campaign_import
, has 7 columns. The second table, customer_campaign
, has more columns than the first table with id(uuid type)
as the primary key. Since id
is the type not-null constant
, when I execute the following query:
INSERT INTO customer_campaign (store_name, store_address, store_city, store_province,
store_postal_code, lat, long)
SELECT * FROM customer_campaign_import;
It returns an error:
ERROR: null value in column "id" violates not-null constraint
How do I generate a unique id
for each row of the first table when inserting the first table into the second table?
Upvotes: 0
Views: 2866