ALTER TABLE product ADD CONSTRAINT unique_product UNIQUE (category, brand, product, variant, size);

INSERT INTO product (category, brand, product, variant, size)
SELECT category, brand, product, variant, size
FROM temp_products
ON CONFLICT (category, brand, product, variant, size) DO NOTHING;

ALTER TABLE product
ADD COLUMN category_image text;

UPDATE product p
SET category_image = pfl.category_image
FROM product_full_list pfl
WHERE p.category = pfl.category
  AND p.brand = pfl.brand
  AND p.product = pfl.product
  AND p.variant = pfl.variant
  AND p.size = pfl.size;

 
select distinct p.category_image from product p where p.category_image is not null