-- Create allproducts view
CREATE OR REPLACE VIEW public.allproducts AS
 SELECT products.id,
    products.name,
    products.amount,
    products.fat,
    products.protein,
    products.carbohydrate,
    products.companies_id,
    products.last,
    products.elaboratedproducts_id,
    products.calories,
    products.salt,
    products.cholesterol,
    products.sodium,
    products.potassium,
    products.fiber,
    products.sugars,
    products.saturated_fat,
    products.languages,
    products.system_company,
    true AS system_product
   FROM public.products
UNION
 SELECT personalproducts.id,
    personalproducts.name,
    personalproducts.amount,
    personalproducts.fat,
    personalproducts.protein,
    personalproducts.carbohydrate,
    personalproducts.companies_id,
    personalproducts.last,
    personalproducts.elaboratedproducts_id,
    personalproducts.calories,
    personalproducts.salt,
    personalproducts.cholesterol,
    personalproducts.sodium,
    personalproducts.potassium,
    personalproducts.fiber,
    personalproducts.sugars,
    personalproducts.saturated_fat,
    personalproducts.languages,
    personalproducts.system_company,
    false AS system_product
   FROM public.personalproducts;
