
2025-08-03 08:25:07.786121 --- ERROR --- DatabaseError(message=''int' object does not support indexing',
                                         payload=1,
                                         sql='SELECT * FROM logins WHERE id=%s;')
2025-08-05 15:17:02.305813 --- ERROR --- DatabaseError(message='column "id" does not existLINE 1: WITH passed_id AS (SELECT id AS passed_id FROM test_barcodes...                                  ^',
                                         payload=('%01231003%',),
                                         sql='WITH passed_id AS (SELECT id AS passed_id FROM test_barcodes WHERE barcode=%s),    logistics_id AS (SELECT logistics_info_id FROM test_items WHERE id=(SELECT passed_id FROM passed_id)),    info_id AS (SELECT item_info_id FROM test_items WHERE id=(SELECT passed_id FROM passed_id)),    cte_item_info AS (        SELECT         test_item_info.*,        row_to_json(units.*) as uom         FROM test_item_info        LEFT JOIN units ON test_item_info.uom = units.id        WHERE test_item_info.id = (SELECT item_info_id FROM info_id)    ),    cte_groups AS (        SELECT             test_groups.*,             test_group_items.uuid,            test_group_items.item_type,            test_group_items.qty        FROM test_groups        JOIN test_group_items ON test_groups.id = test_group_items.gr_id        WHERE test_group_items.item_id = (SELECT passed_id FROM passed_id)    ),    cte_shopping_lists AS (        SELECT             test_shopping_lists.*,             test_shopping_list_items.uuid,            test_shopping_list_items.item_type,            test_shopping_list_items.qty        FROM test_shopping_lists        JOIN test_shopping_list_items ON test_shopping_lists.id = test_shopping_list_items.sl_id        WHERE test_shopping_list_items.item_id = (SELECT passed_id FROM passed_id)    ),    cte_itemlinks AS (        SELECT * FROM test_itemlinks WHERE link=(SELECT passed_id FROM passed_id)    ),    cte_item_locations AS (        SELECT * FROM test_item_locations        LEFT JOIN test_locations ON test_locations.id = test_item_locations.location_id        WHERE part_id = (SELECT passed_id FROM passed_id)    ),    cte_logistics_info AS (        SELECT         li.*,         row_to_json(pl) AS primary_location,        row_to_json(ail) AS auto_issue_location,        row_to_json(pz) AS primary_zone,        row_to_json(aiz) AS auto_issue_zone        FROM test_logistics_info AS li        LEFT JOIN test_locations AS pl ON li.primary_location = pl.id        LEFT JOIN test_locations AS ail ON li.auto_issue_location = ail.id        LEFT JOIN test_zones AS pz ON li.primary_zone = pz.id        LEFT JOIN test_zones AS aiz ON li.auto_issue_zone = aiz.id        WHERE li.id=(SELECT logistics_info_id FROM logistics_id)    )SELECT    (SELECT passed_id FROM passed_id) AS passed_id,    test_items.*,    (SELECT COALESCE(row_to_json(logis), '{}') FROM cte_logistics_info logis) AS logistics_info,    row_to_json(test_food_info.*) as food_info,     row_to_json(test_brands.*) as brand,    (SELECT COALESCE(row_to_json(ii), '{}') FROM cte_item_info ii) AS item_info,    (SELECT COALESCE(array_agg(row_to_json(g)), '{}') FROM cte_groups g) AS item_groups,    (SELECT COALESCE(array_agg(row_to_json(sl)), '{}') FROM cte_shopping_lists sl) AS item_shopping_lists,    (SELECT COALESCE(array_agg(row_to_json(il)), '{}') FROM cte_itemlinks il) AS linked_items,    (SELECT COALESCE(array_agg(row_to_json(ils)), '{}') FROM cte_item_locations ils) AS item_locationsFROM test_items    LEFT JOIN test_item_info ON test_items.item_info_id = test_item_info.id     LEFT JOIN test_food_info ON test_items.food_info_id = test_food_info.id     LEFT JOIN test_brands ON test_items.brand = test_brands.id    LEFT JOIN units ON test_item_info.uom = units.id     LEFT JOIN cte_groups ON test_items.id = cte_groups.id    LEFT JOIN cte_shopping_lists ON test_items.id = cte_shopping_lists.idWHERE test_items.id=(SELECT passed_id FROM passed_id)GROUP BY     test_items.id, test_item_info.id, test_food_info.id, test_brands.id;')
2025-08-05 15:19:02.753652 --- ERROR --- DatabaseError(message='tuple index out of range',
                                         payload=('%01231003%',),
                                         sql='WITH item_uuid AS (SELECT item_uuid AS item_uuid FROM test_barcodes WHERE barcode=%s),    passed_id As (SELECT id AS passed_id FROM test_items WHERE item_uuid=%s),    logistics_id AS (SELECT logistics_info_id FROM test_items WHERE id=(SELECT passed_id FROM passed_id)),    info_id AS (SELECT item_info_id FROM test_items WHERE id=(SELECT passed_id FROM passed_id)),    cte_item_info AS (        SELECT         test_item_info.*,        row_to_json(units.*) as uom         FROM test_item_info        LEFT JOIN units ON test_item_info.uom = units.id        WHERE test_item_info.id = (SELECT item_info_id FROM info_id)    ),    cte_groups AS (        SELECT             test_groups.*,             test_group_items.uuid,            test_group_items.item_type,            test_group_items.qty        FROM test_groups        JOIN test_group_items ON test_groups.id = test_group_items.gr_id        WHERE test_group_items.item_id = (SELECT passed_id FROM passed_id)    ),    cte_shopping_lists AS (        SELECT             test_shopping_lists.*,             test_shopping_list_items.uuid,            test_shopping_list_items.item_type,            test_shopping_list_items.qty        FROM test_shopping_lists        JOIN test_shopping_list_items ON test_shopping_lists.id = test_shopping_list_items.sl_id        WHERE test_shopping_list_items.item_id = (SELECT passed_id FROM passed_id)    ),    cte_itemlinks AS (        SELECT * FROM test_itemlinks WHERE link=(SELECT passed_id FROM passed_id)    ),    cte_item_locations AS (        SELECT * FROM test_item_locations        LEFT JOIN test_locations ON test_locations.id = test_item_locations.location_id        WHERE part_id = (SELECT passed_id FROM passed_id)    ),    cte_logistics_info AS (        SELECT         li.*,         row_to_json(pl) AS primary_location,        row_to_json(ail) AS auto_issue_location,        row_to_json(pz) AS primary_zone,        row_to_json(aiz) AS auto_issue_zone        FROM test_logistics_info AS li        LEFT JOIN test_locations AS pl ON li.primary_location = pl.id        LEFT JOIN test_locations AS ail ON li.auto_issue_location = ail.id        LEFT JOIN test_zones AS pz ON li.primary_zone = pz.id        LEFT JOIN test_zones AS aiz ON li.auto_issue_zone = aiz.id        WHERE li.id=(SELECT logistics_info_id FROM logistics_id)    )SELECT    (SELECT passed_id FROM passed_id) AS passed_id,    test_items.*,    (SELECT COALESCE(row_to_json(logis), '{}') FROM cte_logistics_info logis) AS logistics_info,    row_to_json(test_food_info.*) as food_info,     row_to_json(test_brands.*) as brand,    (SELECT COALESCE(row_to_json(ii), '{}') FROM cte_item_info ii) AS item_info,    (SELECT COALESCE(array_agg(row_to_json(g)), '{}') FROM cte_groups g) AS item_groups,    (SELECT COALESCE(array_agg(row_to_json(sl)), '{}') FROM cte_shopping_lists sl) AS item_shopping_lists,    (SELECT COALESCE(array_agg(row_to_json(il)), '{}') FROM cte_itemlinks il) AS linked_items,    (SELECT COALESCE(array_agg(row_to_json(ils)), '{}') FROM cte_item_locations ils) AS item_locationsFROM test_items    LEFT JOIN test_item_info ON test_items.item_info_id = test_item_info.id     LEFT JOIN test_food_info ON test_items.food_info_id = test_food_info.id     LEFT JOIN test_brands ON test_items.brand = test_brands.id    LEFT JOIN units ON test_item_info.uom = units.id     LEFT JOIN cte_groups ON test_items.id = cte_groups.id    LEFT JOIN cte_shopping_lists ON test_items.id = cte_shopping_lists.idWHERE test_items.id=(SELECT passed_id FROM passed_id)GROUP BY     test_items.id, test_item_info.id, test_food_info.id, test_brands.id;')
2025-08-05 15:21:40.124158 --- ERROR --- DatabaseError(message='column reference "barcode" is ambiguousLINE 1: ...t_items.item_uuid = test_barcodes.item_uuid WHERE barcode='%...                                                             ^',
                                         payload=('%01231003%',),
                                         sql='WITH passed_id AS (SELECT id AS passed_id FROM test_barcodes LEFT JOIN test_items ON test_items.item_uuid = test_barcodes.item_uuid WHERE barcode=%s),    logistics_id AS (SELECT logistics_info_id FROM test_items WHERE id=(SELECT passed_id FROM passed_id)),    info_id AS (SELECT item_info_id FROM test_items WHERE id=(SELECT passed_id FROM passed_id)),    cte_item_info AS (        SELECT         test_item_info.*,        row_to_json(units.*) as uom         FROM test_item_info        LEFT JOIN units ON test_item_info.uom = units.id        WHERE test_item_info.id = (SELECT item_info_id FROM info_id)    ),    cte_groups AS (        SELECT             test_groups.*,             test_group_items.uuid,            test_group_items.item_type,            test_group_items.qty        FROM test_groups        JOIN test_group_items ON test_groups.id = test_group_items.gr_id        WHERE test_group_items.item_id = (SELECT passed_id FROM passed_id)    ),    cte_shopping_lists AS (        SELECT             test_shopping_lists.*,             test_shopping_list_items.uuid,            test_shopping_list_items.item_type,            test_shopping_list_items.qty        FROM test_shopping_lists        JOIN test_shopping_list_items ON test_shopping_lists.id = test_shopping_list_items.sl_id        WHERE test_shopping_list_items.item_id = (SELECT passed_id FROM passed_id)    ),    cte_itemlinks AS (        SELECT * FROM test_itemlinks WHERE link=(SELECT passed_id FROM passed_id)    ),    cte_item_locations AS (        SELECT * FROM test_item_locations        LEFT JOIN test_locations ON test_locations.id = test_item_locations.location_id        WHERE part_id = (SELECT passed_id FROM passed_id)    ),    cte_logistics_info AS (        SELECT         li.*,         row_to_json(pl) AS primary_location,        row_to_json(ail) AS auto_issue_location,        row_to_json(pz) AS primary_zone,        row_to_json(aiz) AS auto_issue_zone        FROM test_logistics_info AS li        LEFT JOIN test_locations AS pl ON li.primary_location = pl.id        LEFT JOIN test_locations AS ail ON li.auto_issue_location = ail.id        LEFT JOIN test_zones AS pz ON li.primary_zone = pz.id        LEFT JOIN test_zones AS aiz ON li.auto_issue_zone = aiz.id        WHERE li.id=(SELECT logistics_info_id FROM logistics_id)    )SELECT    (SELECT passed_id FROM passed_id) AS passed_id,    test_items.*,    (SELECT COALESCE(row_to_json(logis), '{}') FROM cte_logistics_info logis) AS logistics_info,    row_to_json(test_food_info.*) as food_info,     row_to_json(test_brands.*) as brand,    (SELECT COALESCE(row_to_json(ii), '{}') FROM cte_item_info ii) AS item_info,    (SELECT COALESCE(array_agg(row_to_json(g)), '{}') FROM cte_groups g) AS item_groups,    (SELECT COALESCE(array_agg(row_to_json(sl)), '{}') FROM cte_shopping_lists sl) AS item_shopping_lists,    (SELECT COALESCE(array_agg(row_to_json(il)), '{}') FROM cte_itemlinks il) AS linked_items,    (SELECT COALESCE(array_agg(row_to_json(ils)), '{}') FROM cte_item_locations ils) AS item_locationsFROM test_items    LEFT JOIN test_item_info ON test_items.item_info_id = test_item_info.id     LEFT JOIN test_food_info ON test_items.food_info_id = test_food_info.id     LEFT JOIN test_brands ON test_items.brand = test_brands.id    LEFT JOIN units ON test_item_info.uom = units.id     LEFT JOIN cte_groups ON test_items.id = cte_groups.id    LEFT JOIN cte_shopping_lists ON test_items.id = cte_shopping_lists.idWHERE test_items.id=(SELECT passed_id FROM passed_id)GROUP BY     test_items.id, test_item_info.id, test_food_info.id, test_brands.id;')
2025-08-05 15:21:59.561578 --- ERROR --- DatabaseError(message='column reference "barcode" is ambiguousLINE 1: ...t_items.item_uuid = test_barcodes.item_uuid WHERE barcode='%...                                                             ^',
                                         payload=('%01231003%',),
                                         sql='WITH passed_id AS (SELECT test_items.id AS passed_id FROM test_barcodes LEFT JOIN test_items ON test_items.item_uuid = test_barcodes.item_uuid WHERE barcode=%s),    logistics_id AS (SELECT logistics_info_id FROM test_items WHERE id=(SELECT passed_id FROM passed_id)),    info_id AS (SELECT item_info_id FROM test_items WHERE id=(SELECT passed_id FROM passed_id)),    cte_item_info AS (        SELECT         test_item_info.*,        row_to_json(units.*) as uom         FROM test_item_info        LEFT JOIN units ON test_item_info.uom = units.id        WHERE test_item_info.id = (SELECT item_info_id FROM info_id)    ),    cte_groups AS (        SELECT             test_groups.*,             test_group_items.uuid,            test_group_items.item_type,            test_group_items.qty        FROM test_groups        JOIN test_group_items ON test_groups.id = test_group_items.gr_id        WHERE test_group_items.item_id = (SELECT passed_id FROM passed_id)    ),    cte_shopping_lists AS (        SELECT             test_shopping_lists.*,             test_shopping_list_items.uuid,            test_shopping_list_items.item_type,            test_shopping_list_items.qty        FROM test_shopping_lists        JOIN test_shopping_list_items ON test_shopping_lists.id = test_shopping_list_items.sl_id        WHERE test_shopping_list_items.item_id = (SELECT passed_id FROM passed_id)    ),    cte_itemlinks AS (        SELECT * FROM test_itemlinks WHERE link=(SELECT passed_id FROM passed_id)    ),    cte_item_locations AS (        SELECT * FROM test_item_locations        LEFT JOIN test_locations ON test_locations.id = test_item_locations.location_id        WHERE part_id = (SELECT passed_id FROM passed_id)    ),    cte_logistics_info AS (        SELECT         li.*,         row_to_json(pl) AS primary_location,        row_to_json(ail) AS auto_issue_location,        row_to_json(pz) AS primary_zone,        row_to_json(aiz) AS auto_issue_zone        FROM test_logistics_info AS li        LEFT JOIN test_locations AS pl ON li.primary_location = pl.id        LEFT JOIN test_locations AS ail ON li.auto_issue_location = ail.id        LEFT JOIN test_zones AS pz ON li.primary_zone = pz.id        LEFT JOIN test_zones AS aiz ON li.auto_issue_zone = aiz.id        WHERE li.id=(SELECT logistics_info_id FROM logistics_id)    )SELECT    (SELECT passed_id FROM passed_id) AS passed_id,    test_items.*,    (SELECT COALESCE(row_to_json(logis), '{}') FROM cte_logistics_info logis) AS logistics_info,    row_to_json(test_food_info.*) as food_info,     row_to_json(test_brands.*) as brand,    (SELECT COALESCE(row_to_json(ii), '{}') FROM cte_item_info ii) AS item_info,    (SELECT COALESCE(array_agg(row_to_json(g)), '{}') FROM cte_groups g) AS item_groups,    (SELECT COALESCE(array_agg(row_to_json(sl)), '{}') FROM cte_shopping_lists sl) AS item_shopping_lists,    (SELECT COALESCE(array_agg(row_to_json(il)), '{}') FROM cte_itemlinks il) AS linked_items,    (SELECT COALESCE(array_agg(row_to_json(ils)), '{}') FROM cte_item_locations ils) AS item_locationsFROM test_items    LEFT JOIN test_item_info ON test_items.item_info_id = test_item_info.id     LEFT JOIN test_food_info ON test_items.food_info_id = test_food_info.id     LEFT JOIN test_brands ON test_items.brand = test_brands.id    LEFT JOIN units ON test_item_info.uom = units.id     LEFT JOIN cte_groups ON test_items.id = cte_groups.id    LEFT JOIN cte_shopping_lists ON test_items.id = cte_shopping_lists.idWHERE test_items.id=(SELECT passed_id FROM passed_id)GROUP BY     test_items.id, test_item_info.id, test_food_info.id, test_brands.id;')
2025-08-05 15:24:44.958603 --- ERROR --- DatabaseError(message='column reference "barcode" is ambiguousLINE 3:                     WHERE barcode='%041789001314%'),                                  ^',
                                         payload=('%041789001314%',),
                                         sql='WITH passed_id AS (SELECT test_items.id AS passed_id FROM test_barcodes                     LEFT JOIN test_items ON test_items.item_uuid = test_barcodes.item_uuid                     WHERE barcode=%s),    logistics_id AS (SELECT logistics_info_id FROM test_items WHERE id=(SELECT passed_id FROM passed_id)),    info_id AS (SELECT item_info_id FROM test_items WHERE id=(SELECT passed_id FROM passed_id)),    cte_item_info AS (        SELECT         test_item_info.*,        row_to_json(units.*) as uom         FROM test_item_info        LEFT JOIN units ON test_item_info.uom = units.id        WHERE test_item_info.id = (SELECT item_info_id FROM info_id)    ),    cte_groups AS (        SELECT             test_groups.*,             test_group_items.uuid,            test_group_items.item_type,            test_group_items.qty        FROM test_groups        JOIN test_group_items ON test_groups.id = test_group_items.gr_id        WHERE test_group_items.item_id = (SELECT passed_id FROM passed_id)    ),    cte_shopping_lists AS (        SELECT             test_shopping_lists.*,             test_shopping_list_items.uuid,            test_shopping_list_items.item_type,            test_shopping_list_items.qty        FROM test_shopping_lists        JOIN test_shopping_list_items ON test_shopping_lists.id = test_shopping_list_items.sl_id        WHERE test_shopping_list_items.item_id = (SELECT passed_id FROM passed_id)    ),    cte_itemlinks AS (        SELECT * FROM test_itemlinks WHERE link=(SELECT passed_id FROM passed_id)    ),    cte_item_locations AS (        SELECT * FROM test_item_locations        LEFT JOIN test_locations ON test_locations.id = test_item_locations.location_id        WHERE part_id = (SELECT passed_id FROM passed_id)    ),    cte_logistics_info AS (        SELECT         li.*,         row_to_json(pl) AS primary_location,        row_to_json(ail) AS auto_issue_location,        row_to_json(pz) AS primary_zone,        row_to_json(aiz) AS auto_issue_zone        FROM test_logistics_info AS li        LEFT JOIN test_locations AS pl ON li.primary_location = pl.id        LEFT JOIN test_locations AS ail ON li.auto_issue_location = ail.id        LEFT JOIN test_zones AS pz ON li.primary_zone = pz.id        LEFT JOIN test_zones AS aiz ON li.auto_issue_zone = aiz.id        WHERE li.id=(SELECT logistics_info_id FROM logistics_id)    )SELECT    (SELECT passed_id FROM passed_id) AS passed_id,    test_items.*,    (SELECT COALESCE(row_to_json(logis), '{}') FROM cte_logistics_info logis) AS logistics_info,    row_to_json(test_food_info.*) as food_info,     row_to_json(test_brands.*) as brand,    (SELECT COALESCE(row_to_json(ii), '{}') FROM cte_item_info ii) AS item_info,    (SELECT COALESCE(array_agg(row_to_json(g)), '{}') FROM cte_groups g) AS item_groups,    (SELECT COALESCE(array_agg(row_to_json(sl)), '{}') FROM cte_shopping_lists sl) AS item_shopping_lists,    (SELECT COALESCE(array_agg(row_to_json(il)), '{}') FROM cte_itemlinks il) AS linked_items,    (SELECT COALESCE(array_agg(row_to_json(ils)), '{}') FROM cte_item_locations ils) AS item_locationsFROM test_items    LEFT JOIN test_item_info ON test_items.item_info_id = test_item_info.id     LEFT JOIN test_food_info ON test_items.food_info_id = test_food_info.id     LEFT JOIN test_brands ON test_items.brand = test_brands.id    LEFT JOIN units ON test_item_info.uom = units.id     LEFT JOIN cte_groups ON test_items.id = cte_groups.id    LEFT JOIN cte_shopping_lists ON test_items.id = cte_shopping_lists.idWHERE test_items.id=(SELECT passed_id FROM passed_id)GROUP BY     test_items.id, test_item_info.id, test_food_info.id, test_brands.id;')
2025-08-05 15:25:24.830194 --- ERROR --- DatabaseError(message='invalid reference to FROM-clause entry for table "test_items"LINE 1: WITH passed_id AS (SELECT test_items.id AS passed_id FROM te...                                  ^HINT:  Perhaps you meant to reference the table alias "items".',
                                         payload=('%041789001314%',),
                                         sql='WITH passed_id AS (SELECT test_items.id AS passed_id FROM test_barcodes barcodes                    LEFT JOIN test_items items ON items.item_uuid = barcodes.item_uuid                     WHERE barcodes.barcode=%s),    logistics_id AS (SELECT logistics_info_id FROM test_items WHERE id=(SELECT passed_id FROM passed_id)),    info_id AS (SELECT item_info_id FROM test_items WHERE id=(SELECT passed_id FROM passed_id)),    cte_item_info AS (        SELECT         test_item_info.*,        row_to_json(units.*) as uom         FROM test_item_info        LEFT JOIN units ON test_item_info.uom = units.id        WHERE test_item_info.id = (SELECT item_info_id FROM info_id)    ),    cte_groups AS (        SELECT             test_groups.*,             test_group_items.uuid,            test_group_items.item_type,            test_group_items.qty        FROM test_groups        JOIN test_group_items ON test_groups.id = test_group_items.gr_id        WHERE test_group_items.item_id = (SELECT passed_id FROM passed_id)    ),    cte_shopping_lists AS (        SELECT             test_shopping_lists.*,             test_shopping_list_items.uuid,            test_shopping_list_items.item_type,            test_shopping_list_items.qty        FROM test_shopping_lists        JOIN test_shopping_list_items ON test_shopping_lists.id = test_shopping_list_items.sl_id        WHERE test_shopping_list_items.item_id = (SELECT passed_id FROM passed_id)    ),    cte_itemlinks AS (        SELECT * FROM test_itemlinks WHERE link=(SELECT passed_id FROM passed_id)    ),    cte_item_locations AS (        SELECT * FROM test_item_locations        LEFT JOIN test_locations ON test_locations.id = test_item_locations.location_id        WHERE part_id = (SELECT passed_id FROM passed_id)    ),    cte_logistics_info AS (        SELECT         li.*,         row_to_json(pl) AS primary_location,        row_to_json(ail) AS auto_issue_location,        row_to_json(pz) AS primary_zone,        row_to_json(aiz) AS auto_issue_zone        FROM test_logistics_info AS li        LEFT JOIN test_locations AS pl ON li.primary_location = pl.id        LEFT JOIN test_locations AS ail ON li.auto_issue_location = ail.id        LEFT JOIN test_zones AS pz ON li.primary_zone = pz.id        LEFT JOIN test_zones AS aiz ON li.auto_issue_zone = aiz.id        WHERE li.id=(SELECT logistics_info_id FROM logistics_id)    )SELECT    (SELECT passed_id FROM passed_id) AS passed_id,    test_items.*,    (SELECT COALESCE(row_to_json(logis), '{}') FROM cte_logistics_info logis) AS logistics_info,    row_to_json(test_food_info.*) as food_info,     row_to_json(test_brands.*) as brand,    (SELECT COALESCE(row_to_json(ii), '{}') FROM cte_item_info ii) AS item_info,    (SELECT COALESCE(array_agg(row_to_json(g)), '{}') FROM cte_groups g) AS item_groups,    (SELECT COALESCE(array_agg(row_to_json(sl)), '{}') FROM cte_shopping_lists sl) AS item_shopping_lists,    (SELECT COALESCE(array_agg(row_to_json(il)), '{}') FROM cte_itemlinks il) AS linked_items,    (SELECT COALESCE(array_agg(row_to_json(ils)), '{}') FROM cte_item_locations ils) AS item_locationsFROM test_items    LEFT JOIN test_item_info ON test_items.item_info_id = test_item_info.id     LEFT JOIN test_food_info ON test_items.food_info_id = test_food_info.id     LEFT JOIN test_brands ON test_items.brand = test_brands.id    LEFT JOIN units ON test_item_info.uom = units.id     LEFT JOIN cte_groups ON test_items.id = cte_groups.id    LEFT JOIN cte_shopping_lists ON test_items.id = cte_shopping_lists.idWHERE test_items.id=(SELECT passed_id FROM passed_id)GROUP BY     test_items.id, test_item_info.id, test_food_info.id, test_brands.id;')
2025-08-08 18:22:06.689520 --- ERROR --- DatabaseError(message='syntax error at or near ","LINE 1: ..., in_exchange, out_exchange, descriptor) VALUES (?, ?, ?, ?,...                                                             ^',
                                         payload=('%test%', '44c41878-e645-4e16-a402-e480936ac4aa', 1, 1, 'normal test'),
                                         sql='INSERT INTO test_barcodes (barcode, item_uuid, in_exchange, out_exchange, descriptor) VALUES (?, ?, ?, ?, ?);')
2025-08-08 18:23:47.408991 --- ERROR --- DatabaseError(message='syntax error at or near ","LINE 1: ..., in_exchange, out_exchange, descriptor) VALUES (?, ?, ?, ?,...                                                             ^',
                                         payload=('%test%', '44c41878-e645-4e16-a402-e480936ac4aa', 1, 1, 'normal test'),
                                         sql='INSERT INTO test_barcodes (barcode, item_uuid, in_exchange, out_exchange, descriptor) VALUES (?, ?, ?, ?, ?) RETURNING *;')
2025-08-08 18:25:41.824363 --- ERROR --- DatabaseError(message='duplicate key value violates unique constraint "test_barcodes_pkey"DETAIL:  Key (barcode)=(%test%) already exists.',
                                         payload=('%test%', '44c41878-e645-4e16-a402-e480936ac4aa', 1, 1, 'normal test'),
                                         sql='INSERT INTO test_barcodes (barcode, item_uuid, in_exchange, out_exchange, descriptor) VALUES (%s, %s, %s, %s, %s) RETURNING *;')
2025-08-09 07:32:58.410729 --- ERROR --- DatabaseError(message='duplicate key value violates unique constraint "test_barcodes_pkey"DETAIL:  Key (barcode)=(tsath) already exists.',
                                         payload=('tsath', '44c41878-e645-4e16-a402-e480936ac4aa', '2', '2', 'test2'),
                                         sql='INSERT INTO test_barcodes (barcode, item_uuid, in_exchange, out_exchange, descriptor) VALUES (%s, %s, %s, %s, %s) RETURNING *;')
2025-08-09 07:34:13.926705 --- ERROR --- DatabaseError(message='duplicate key value violates unique constraint "test_barcodes_pkey"DETAIL:  Key (barcode)=(tsath) already exists.',
                                         payload=('tsath', '44c41878-e645-4e16-a402-e480936ac4aa', '1', '1', 'test'),
                                         sql='INSERT INTO test_barcodes (barcode, item_uuid, in_exchange, out_exchange, descriptor) VALUES (%s, %s, %s, %s, %s) RETURNING *;')
2025-08-09 08:07:31.538747 --- ERROR --- DatabaseError(message='can't adapt type 'dict'',
                                         payload={'barcode': {'barcode': 'tsath', 'descriptor': 'test', 'in_exchange': 1, 'out_exchange': 1}, 'update': {'in_exchange': '1', 'out_exchange': '1', 'descriptor': 'test changed'}},
                                         sql='UPDATE test_barcodes SET in_exchange = %s, out_exchange = %s, descriptor = %s WHERE barcode=%s RETURNING *;')
2025-08-09 08:08:14.996560 --- ERROR --- DatabaseError(message='can't adapt type 'dict'',
                                         payload={'barcode': {'barcode': 'tsath', 'descriptor': 'test', 'in_exchange': 1, 'out_exchange': 1}, 'update': {'in_exchange': '1', 'out_exchange': '1', 'descriptor': 'test c'}},
                                         sql='UPDATE test_barcodes SET in_exchange = %s, out_exchange = %s, descriptor = %s WHERE barcode=%s RETURNING *;')
2025-08-09 08:08:51.302903 --- ERROR --- DatabaseError(message='can't adapt type 'dict'',
                                         payload={'barcode': {'barcode': 'tsath', 'descriptor': 'test', 'in_exchange': 1, 'out_exchange': 1}, 'update': {'in_exchange': '1', 'out_exchange': '1', 'descriptor': 'test ggh'}},
                                         sql='UPDATE test_barcodes SET in_exchange = %s, out_exchange = %s, descriptor = %s WHERE barcode=%s RETURNING *;')
2025-08-09 11:07:03.004000 --- ERROR --- DatabaseError(message='not all arguments converted during string formatting',
                                         payload=('PLU SKU', 30, None, '8cac7ce9-dfd1-4da8-8856-57f5bdbc752b', 'Bubble Bath Lavender', 1, 1, '{"cost": 0, "expires": false}', 'Unresolved'),
                                         sql='INSERT INTO test_receipt_items(type, receipt_id, barcode, name, qty, uom, data, status) VALUES (%s, %s, %s, %s, %s, %s, %s, %s) RETURNING *;')
2025-08-09 11:52:23.005675 --- ERROR --- DatabaseError(message='duplicate key value violates unique constraint "test_barcodes_pkey"DETAIL:  Key (barcode)=(%6589%) already exists.',
                                         payload=('%6589%', '7bdc9602-ca87-4e9f-b9ef-fc5e8f0eceb7', 1.0, 1.0, 'Test Item 22'),
                                         sql='INSERT INTO test_barcodes (barcode, item_uuid, in_exchange, out_exchange, descriptor) VALUES (%s, %s, %s, %s, %s) RETURNING *;')
2025-08-09 14:49:30.457282 --- ERROR --- DatabaseError(message='not all arguments converted during string formatting',
                                         payload=('sku', 36, '%078742015101%', '3405b49b-843a-4bca-a235-686e4a9f2e73', '100% grated parmesan cheese', 1, 1, '{"cost": 0, "expires": false}', 'Unresolved'),
                                         sql='INSERT INTO test_receipt_items(type, receipt_id, barcode, name, qty, uom, data, status) VALUES (%s, %s, %s, %s, %s, %s, %s, %s) RETURNING *;')
2025-08-09 14:51:18.570501 --- ERROR --- DatabaseError(message='not all arguments converted during string formatting',
                                         payload=('sku', 36, '%078742015101%', '3405b49b-843a-4bca-a235-686e4a9f2e73', '100% grated parmesan cheese', 1, 1, '{"cost": 0, "expires": false}', 'Unresolved'),
                                         sql='INSERT INTO test_receipt_items(type, receipt_id, barcode, name, qty, uom, data, status) VALUES (%s, %s, %s, %s, %s, %s, %s, %s) RETURNING *;')
2025-08-09 14:53:40.869005 --- ERROR --- DatabaseError(message='not all arguments converted during string formatting',
                                         payload=('sku', 36, '%078742015101%', '3405b49b-843a-4bca-a235-686e4a9f2e73', '100% grated parmesan cheese', 1, 1, '{"cost": 0, "expires": false}', 'Unresolved'),
                                         sql='INSERT INTO test_receipt_items(type, receipt_id, barcode, name, qty, uom, data, status) VALUES (%s, %s, %s, %s, %s, %s, %s, %s) RETURNING *;')
2025-08-09 15:57:58.332708 --- ERROR --- DatabaseError(message='invalid input syntax for type uuid: ""LINE 3: VALUES ('custom', 36, '', '', 'test1', '1', '2', '{"cost": "...                                  ^',
                                         payload=('custom', 36, '', '', 'test1', '1', '2', '{"cost": "0.99", "expires": false}', 'Unresolved'),
                                         sql='INSERT INTO test_receipt_items(type, receipt_id, barcode, item_uuid, name, qty, uom, data, status) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s) RETURNING *;')
2025-08-09 16:10:49.684466 --- ERROR --- DatabaseError(message='operator does not exist: integer = character varyingLINE 4: ...(row_to_json(un), '{}') FROM units un WHERE un.id = items.uo...                                                             ^HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.',
                                         payload=(1,),
                                         sql='WITH passed_id AS (SELECT %s AS passed_id),    cte_receipt_items AS (            SELECT items.* ,            (SELECT COALESCE(row_to_json(un), '{}') FROM units un WHERE un.id = items.uom LIMIT 1) AS uom            FROM testa_receipt_items items            WHERE items.receipt_id = (SELECT passed_id FROM passed_id)            ORDER BY items.name ASC        )SELECT (SELECT passed_id FROM passed_id) AS passed_id,     testa_receipts.*,     logins.username as submitted_by,     (SELECT COALESCE(array_agg(row_to_json(ris)), '{}') FROM cte_receipt_items ris) AS receipt_items,     row_to_json(testa_vendors.*) as vendorFROM testa_receiptsJOIN logins ON testa_receipts.submitted_by = logins.idLEFT JOIN testa_vendors ON testa_receipts.vendor_id = testa_vendors.id WHERE testa_receipts.id=(SELECT passed_id FROM passed_id)')
2025-08-09 16:20:46.492869 --- ERROR --- DatabaseError(message='relation "testa_recipes" does not existLINE 3:  FROM testa_recipes LIMIT 10 OFFSET 0;              ^',
                                         payload=(10, 0),
                                         sql='SELECT *,    (SELECT COALESCE(array_agg(row_to_json(g)), '{}') FROM testa_recipe_items g WHERE rp_id = testa_recipes.id) AS rp_items FROM testa_recipes LIMIT %s OFFSET %s;')
2025-08-09 19:39:51.459243 --- ERROR --- DatabaseError(message='invalid input syntax for type uuid: "%812446030134%"LINE 3: VALUES ('%812446030134%', 6, 'sku', 'Rice cooked in bone bro...                ^',
                                         payload=('%812446030134%', 6, 'sku', 'Rice cooked in bone broth', 1, 1.0, 8, '{}'),
                                         sql='INSERT INTO main_recipe_items(item_uuid, rp_id, item_type, item_name, uom, qty, item_id, links) VALUES (%s, %s, %s, %s, %s, %s, %s, %s) RETURNING *;')
2025-08-09 19:39:52.911421 --- ERROR --- DatabaseError(message='invalid input syntax for type uuid: "%812446030134%"LINE 3: VALUES ('%812446030134%', 6, 'sku', 'Rice cooked in bone bro...                ^',
                                         payload=('%812446030134%', 6, 'sku', 'Rice cooked in bone broth', 1, 1.0, 8, '{}'),
                                         sql='INSERT INTO main_recipe_items(item_uuid, rp_id, item_type, item_name, uom, qty, item_id, links) VALUES (%s, %s, %s, %s, %s, %s, %s, %s) RETURNING *;')
2025-08-09 19:39:53.115678 --- ERROR --- DatabaseError(message='invalid input syntax for type uuid: "%812446030134%"LINE 3: VALUES ('%812446030134%', 6, 'sku', 'Rice cooked in bone bro...                ^',
                                         payload=('%812446030134%', 6, 'sku', 'Rice cooked in bone broth', 1, 1.0, 8, '{}'),
                                         sql='INSERT INTO main_recipe_items(item_uuid, rp_id, item_type, item_name, uom, qty, item_id, links) VALUES (%s, %s, %s, %s, %s, %s, %s, %s) RETURNING *;')
2025-08-09 19:39:54.082880 --- ERROR --- DatabaseError(message='invalid input syntax for type uuid: "%812446030134%"LINE 3: VALUES ('%812446030134%', 6, 'sku', 'Rice cooked in bone bro...                ^',
                                         payload=('%812446030134%', 6, 'sku', 'Rice cooked in bone broth', 1, 1.0, 8, '{}'),
                                         sql='INSERT INTO main_recipe_items(item_uuid, rp_id, item_type, item_name, uom, qty, item_id, links) VALUES (%s, %s, %s, %s, %s, %s, %s, %s) RETURNING *;')
2025-08-09 19:39:54.266687 --- ERROR --- DatabaseError(message='invalid input syntax for type uuid: "%812446030134%"LINE 3: VALUES ('%812446030134%', 6, 'sku', 'Rice cooked in bone bro...                ^',
                                         payload=('%812446030134%', 6, 'sku', 'Rice cooked in bone broth', 1, 1.0, 8, '{}'),
                                         sql='INSERT INTO main_recipe_items(item_uuid, rp_id, item_type, item_name, uom, qty, item_id, links) VALUES (%s, %s, %s, %s, %s, %s, %s, %s) RETURNING *;')
2025-08-09 19:56:12.367519 --- ERROR --- DatabaseError(message='column "g" does not existLINE 2:     (SELECT COALESCE(array_agg(row_to_json(g)), '{}')                                                    ^',
                                         payload=(25, 0),
                                         sql='SELECT *,    (SELECT COALESCE(array_agg(row_to_json(g)), '{}')     FROM test_recipe_items rp_item    LEFT JOIN test_items items ON items.item_uuid = rp_item.item_uuid    WHERE rp_id = test_recipes.id) AS rp_itemsFROM test_recipes LIMIT %s OFFSET %s;')
2025-08-09 20:03:06.560301 --- ERROR --- DatabaseError(message='column sum_cte.id does not existLINE 14:     LEFT JOIN sum_cte ON items.id = sum_cte.id                                             ^',
                                         payload=(25, 0),
                                         sql='WITH sum_cte AS (      SELECT items.item_uuid, SUM(items_locations.quantity_on_hand)::FLOAT8 AS total_sum      FROM main_item_locations items_locations      JOIN main_items items ON items_locations.part_id = items.id      GROUP BY items.item_uuid    )SELECT *,    (SELECT COALESCE(array_agg(row_to_json(rp_item)), '{}')     FROM main_recipe_items rp_item    LEFT JOIN main_items items ON items.item_uuid = rp_item.item_uuid    LEFT JOIN sum_cte ON items.id = sum_cte.id    WHERE rp_item.rp_id = main_recipes.id) AS rp_itemsFROM main_recipes LIMIT %s OFFSET %s;')
2025-08-09 20:05:35.624889 --- ERROR --- DatabaseError(message='column "sum_cte.total_sum" must appear in the GROUP BY clause or be used in an aggregate functionLINE 11: ...OALESCE(array_agg(row_to_json(rp_item.*)), '{}'), sum_cte.to...                                                              ^',
                                         payload=(25, 0),
                                         sql='WITH sum_cte AS (      SELECT mi.id, SUM(mil.quantity_on_hand)::FLOAT8 AS total_sum      FROM main_item_locations mil      JOIN main_items mi ON mil.part_id = mi.id      GROUP BY mi.id    )SELECT *,    (SELECT COALESCE(array_agg(row_to_json(rp_item.*)), '{}'), sum_cte.total_sum    FROM main_recipe_items rp_item    LEFT JOIN main_items items ON items.item_uuid = rp_item.item_uuid    LEFT JOIN sum_cte ON items.id = sum_cte.id    WHERE rp_item.rp_id = main_recipes.id) AS rp_itemsFROM main_recipes LIMIT %s OFFSET %s;')
2025-08-09 20:17:43.956632 --- ERROR --- DatabaseError(message='missing FROM-clause entry for table "rp_item"LINE 17: LEFT JOIN cte_recipe_items rp_items ON rp_item.rp_id = recip...                                                ^',
                                         payload=(25, 0),
                                         sql='WITH sum_cte AS (      SELECT mi.item_uuid, SUM(mil.quantity_on_hand)::FLOAT8 AS total_sum      FROM main_item_locations mil      JOIN main_items mi ON mil.part_id = mi.id      GROUP BY mi.id    ),    cte_recipe_items AS (        SELECT rp_item.*, COALESCE(sum_cte.total_sum, 0) as quantity_on_hand FROM main_recipe_items rp_item        LEFT JOIN sum_cte ON sum_cte.item_uuid = rp_item.item_uuid    )SELECT *,    (SELECT COALESCE(row_to_json(rp_it), '{}') FROM rp_items rp_it) AS rp_itemsFROM main_recipes recipesLEFT JOIN cte_recipe_items rp_items ON rp_item.rp_id = recipes.id LIMIT %s OFFSET %s;')
2025-08-09 20:17:56.230829 --- ERROR --- DatabaseError(message='missing FROM-clause entry for table "rp_item"LINE 17: LEFT JOIN cte_recipe_items rp_items ON rp_item.rp_id = recip...                                                ^',
                                         payload=(25, 0),
                                         sql='WITH sum_cte AS (      SELECT mi.item_uuid, SUM(mil.quantity_on_hand)::FLOAT8 AS total_sum      FROM main_item_locations mil      JOIN main_items mi ON mil.part_id = mi.id      GROUP BY mi.id    ),    cte_recipe_items AS (        SELECT rp_item.*, COALESCE(sum_cte.total_sum, 0) as quantity_on_hand FROM main_recipe_items rp_item        LEFT JOIN sum_cte ON sum_cte.item_uuid = rp_item.item_uuid    )SELECT *,    (SELECT COALESCE(row_to_json(rp_it), '{}') FROM rp_items rp_it) AS testFROM main_recipes recipesLEFT JOIN cte_recipe_items rp_items ON rp_item.rp_id = recipes.id LIMIT %s OFFSET %s;')
2025-08-09 20:18:34.287696 --- ERROR --- DatabaseError(message='relation "rp_items" does not existLINE 15: ...  (SELECT COALESCE(row_to_json(rp_it), '{}') FROM rp_items r...                                                              ^',
                                         payload=(25, 0),
                                         sql='WITH sum_cte AS (      SELECT mi.item_uuid, SUM(mil.quantity_on_hand)::FLOAT8 AS total_sum      FROM main_item_locations mil      JOIN main_items mi ON mil.part_id = mi.id      GROUP BY mi.id    ),    cte_recipe_items AS (        SELECT rp_item.*, COALESCE(sum_cte.total_sum, 0) as quantity_on_hand FROM main_recipe_items rp_item        LEFT JOIN sum_cte ON sum_cte.item_uuid = rp_item.item_uuid    )SELECT *,    (SELECT COALESCE(row_to_json(rp_it), '{}') FROM rp_items rp_its) AS testFROM main_recipes recipesLEFT JOIN cte_recipe_items rp_items ON rp_items.rp_id = recipes.id LIMIT %s OFFSET %s;')
2025-08-09 20:19:12.850845 --- ERROR --- DatabaseError(message='relation "rp_items" does not existLINE 15: ...  (SELECT COALESCE(row_to_json(rp_it), '{}') FROM rp_items r...                                                              ^',
                                         payload=(25, 0),
                                         sql='WITH sum_cte AS (      SELECT mi.item_uuid, SUM(mil.quantity_on_hand)::FLOAT8 AS total_sum      FROM main_item_locations mil      JOIN main_items mi ON mil.part_id = mi.id      GROUP BY mi.id    ),    cte_recipe_items AS (        SELECT rp_item.*, COALESCE(sum_cte.total_sum, 0) as quantity_on_hand FROM main_recipe_items rp_item        LEFT JOIN sum_cte ON sum_cte.item_uuid = rp_item.item_uuid    )SELECT *,    (SELECT COALESCE(row_to_json(rp_it), '{}') FROM rp_items rp_its) AS testFROM main_recipes recipesLEFT JOIN cte_recipe_items ON cte_recipe_items.rp_id = recipes.id LIMIT %s OFFSET %s;')
2025-08-10 07:14:12.230335 --- ERROR --- DatabaseError(message='missing FROM-clause entry for table "item"LINE 13: LEFT JOIN sum_cte ON item.id = sum_cte.id;                              ^',
                                         payload=(),
                                         sql='WITH sum_cte AS (      SELECT mi.id, SUM(mil.quantity_on_hand)::FLOAT8 AS total_sum      FROM main_item_locations mil      JOIN main_items mi ON mil.part_id = mi.id      GROUP BY mi.id    )SELECT * FROM main_items itemsLEFT JOIN main_item_info item_info ON item_info.id = items.item_info_idLEFT JOIN main_food_info food_info ON food_info.id = items.food_info_idLEFT JOIN main_logistics_info logistics_info ON logistics_info.id = items.logistics_info_idLEFT JOIN main_brands brands ON brands.id = items.brandLEFT JOIN sum_cte ON item.id = sum_cte.id;')
2025-08-10 07:45:48.674084 --- ERROR --- DatabaseError(message='more than one row returned by a subquery used as an expression',
                                         payload=(1,),
                                         sql='WITH passed_id AS (SELECT %s AS passed_id),    cte_recipe_items AS (            SELECT items.*,            /*COALESCE(main_items.barcode, items.uuid) AS uuid,*/            (SELECT COALESCE(row_to_json(units.*), '{}') FROM units WHERE units.id=main_item_info.uom) AS item_uom,            COALESCE(main_items.item_name, items.item_name) AS item_name,            COALESCE(main_items.links, items.links) AS links,            row_to_json(units.*) as uom,            (SELECT COALESCE(array_agg(jsonb_build_object('conversion', conv, 'unit', units)), '{}')                FROM main_conversions conv                LEFT JOIN units ON conv.uom_id = units.id                WHERE conv.item_id = main_items.id) AS conversions,            (SELECT SUM(mil.quantity_on_hand)::FLOAT8 AS total_sum                FROM main_item_locations mil                JOIN main_items mi ON mil.part_id = mi.id                WHERE mil.part_id = mi.id                GROUP BY mi.id            )            FROM main_recipe_items items            LEFT JOIN main_items ON items.item_id = main_items.id            LEFT JOIN main_item_info ON main_items.item_info_id = main_item_info.id            LEFT JOIN units ON units.id =  items.uom            WHERE items.rp_id = (SELECT passed_id FROM passed_id)            ORDER BY items.item_name ASC        )    SELECT (SELECT passed_id FROM passed_id) AS passed_id,     main_recipes.*,     logins.username as author,     (SELECT COALESCE(array_agg(row_to_json(ris)), '{}') FROM cte_recipe_items ris) AS recipe_itemsFROM main_recipesJOIN logins ON main_recipes.author = logins.idWHERE main_recipes.id=(SELECT passed_id FROM passed_id)')
2025-08-10 07:46:23.645592 --- ERROR --- DatabaseError(message='more than one row returned by a subquery used as an expression',
                                         payload=(1,),
                                         sql='WITH passed_id AS (SELECT %s AS passed_id),    cte_recipe_items AS (            SELECT items.*,            /*COALESCE(main_items.barcode, items.uuid) AS uuid,*/            (SELECT COALESCE(row_to_json(units.*), '{}') FROM units WHERE units.id=main_item_info.uom) AS item_uom,            COALESCE(main_items.item_name, items.item_name) AS item_name,            COALESCE(main_items.links, items.links) AS links,            row_to_json(units.*) as uom,            (SELECT COALESCE(array_agg(jsonb_build_object('conversion', conv, 'unit', units)), '{}')                FROM main_conversions conv                LEFT JOIN units ON conv.uom_id = units.id                WHERE conv.item_id = main_items.id) AS conversions,            (SELECT SUM(mil.quantity_on_hand)::FLOAT8                FROM main_item_locations mil                JOIN main_items mi ON mil.part_id = mi.id                WHERE mil.part_id = mi.id                GROUP BY mi.id            ) AS total_sum            FROM main_recipe_items items            LEFT JOIN main_items ON items.item_id = main_items.id            LEFT JOIN main_item_info ON main_items.item_info_id = main_item_info.id            LEFT JOIN units ON units.id =  items.uom            WHERE items.rp_id = (SELECT passed_id FROM passed_id)            ORDER BY items.item_name ASC        )    SELECT (SELECT passed_id FROM passed_id) AS passed_id,     main_recipes.*,     logins.username as author,     (SELECT COALESCE(array_agg(row_to_json(ris)), '{}') FROM cte_recipe_items ris) AS recipe_itemsFROM main_recipesJOIN logins ON main_recipes.author = logins.idWHERE main_recipes.id=(SELECT passed_id FROM passed_id)')
2025-08-10 07:46:46.892560 --- ERROR --- DatabaseError(message='more than one row returned by a subquery used as an expression',
                                         payload=(1,),
                                         sql='WITH passed_id AS (SELECT %s AS passed_id),    cte_recipe_items AS (            SELECT items.*,            /*COALESCE(main_items.barcode, items.uuid) AS uuid,*/            (SELECT COALESCE(row_to_json(units.*), '{}') FROM units WHERE units.id=main_item_info.uom) AS item_uom,            COALESCE(main_items.item_name, items.item_name) AS item_name,            COALESCE(main_items.links, items.links) AS links,            row_to_json(units.*) as uom,            (SELECT COALESCE(array_agg(jsonb_build_object('conversion', conv, 'unit', units)), '{}')                FROM main_conversions conv                LEFT JOIN units ON conv.uom_id = units.id                WHERE conv.item_id = main_items.id) AS conversions,            (SELECT SUM(mil.quantity_on_hand)::FLOAT8                FROM main_item_locations mil                JOIN main_items mi ON mil.part_id = mi.id                GROUP BY mi.id            ) AS total_sum            FROM main_recipe_items items            LEFT JOIN main_items ON items.item_id = main_items.id            LEFT JOIN main_item_info ON main_items.item_info_id = main_item_info.id            LEFT JOIN units ON units.id =  items.uom            WHERE items.rp_id = (SELECT passed_id FROM passed_id)            ORDER BY items.item_name ASC        )    SELECT (SELECT passed_id FROM passed_id) AS passed_id,     main_recipes.*,     logins.username as author,     (SELECT COALESCE(array_agg(row_to_json(ris)), '{}') FROM cte_recipe_items ris) AS recipe_itemsFROM main_recipesJOIN logins ON main_recipes.author = logins.idWHERE main_recipes.id=(SELECT passed_id FROM passed_id)')
2025-08-10 07:48:09.433642 --- ERROR --- DatabaseError(message='syntax error at or near "LEFT"LINE 24:             LEFT LEFT JOIN sum_cte ON item.id = sum_cte.id                          ^',
                                         payload=(1,),
                                         sql='WITH passed_id AS (SELECT %s AS passed_id),    sum_cte AS (      SELECT mi.id, SUM(mil.quantity_on_hand)::FLOAT8 AS total_sum      FROM main_item_locations mil      JOIN main_items mi ON mil.part_id = mi.id      GROUP BY mi.id    ),    cte_recipe_items AS (            SELECT items.*,            /*COALESCE(main_items.barcode, items.uuid) AS uuid,*/            (SELECT COALESCE(row_to_json(units.*), '{}') FROM units WHERE units.id=main_item_info.uom) AS item_uom,            COALESCE(main_items.item_name, items.item_name) AS item_name,            COALESCE(main_items.links, items.links) AS links,            row_to_json(units.*) as uom,            (SELECT COALESCE(array_agg(jsonb_build_object('conversion', conv, 'unit', units)), '{}')                FROM main_conversions conv                LEFT JOIN units ON conv.uom_id = units.id                WHERE conv.item_id = main_items.id) AS conversions,            COALESCE(sum_cte.total_sum, 0) AS quantity_on_hand            FROM main_recipe_items items            LEFT JOIN main_items ON items.item_id = main_items.id            LEFT JOIN main_item_info ON main_items.item_info_id = main_item_info.id            LEFT JOIN units ON units.id =  items.uom            LEFT LEFT JOIN sum_cte ON item.id = sum_cte.id            WHERE items.rp_id = (SELECT passed_id FROM passed_id)            ORDER BY items.item_name ASC        )    SELECT (SELECT passed_id FROM passed_id) AS passed_id,     main_recipes.*,     logins.username as author,     (SELECT COALESCE(array_agg(row_to_json(ris)), '{}') FROM cte_recipe_items ris) AS recipe_itemsFROM main_recipesJOIN logins ON main_recipes.author = logins.idWHERE main_recipes.id=(SELECT passed_id FROM passed_id)')
2025-08-10 07:48:28.429239 --- ERROR --- DatabaseError(message='missing FROM-clause entry for table "item"LINE 24:             LEFT JOIN sum_cte ON item.id = sum_cte.id                                          ^',
                                         payload=(1,),
                                         sql='WITH passed_id AS (SELECT %s AS passed_id),    sum_cte AS (      SELECT mi.id, SUM(mil.quantity_on_hand)::FLOAT8 AS total_sum      FROM main_item_locations mil      JOIN main_items mi ON mil.part_id = mi.id      GROUP BY mi.id    ),    cte_recipe_items AS (            SELECT items.*,            /*COALESCE(main_items.barcode, items.uuid) AS uuid,*/            (SELECT COALESCE(row_to_json(units.*), '{}') FROM units WHERE units.id=main_item_info.uom) AS item_uom,            COALESCE(main_items.item_name, items.item_name) AS item_name,            COALESCE(main_items.links, items.links) AS links,            row_to_json(units.*) as uom,            (SELECT COALESCE(array_agg(jsonb_build_object('conversion', conv, 'unit', units)), '{}')                FROM main_conversions conv                LEFT JOIN units ON conv.uom_id = units.id                WHERE conv.item_id = main_items.id) AS conversions,            COALESCE(sum_cte.total_sum, 0) AS quantity_on_hand            FROM main_recipe_items items            LEFT JOIN main_items ON items.item_id = main_items.id            LEFT JOIN main_item_info ON main_items.item_info_id = main_item_info.id            LEFT JOIN units ON units.id =  items.uom            LEFT JOIN sum_cte ON item.id = sum_cte.id            WHERE items.rp_id = (SELECT passed_id FROM passed_id)            ORDER BY items.item_name ASC        )    SELECT (SELECT passed_id FROM passed_id) AS passed_id,     main_recipes.*,     logins.username as author,     (SELECT COALESCE(array_agg(row_to_json(ris)), '{}') FROM cte_recipe_items ris) AS recipe_itemsFROM main_recipesJOIN logins ON main_recipes.author = logins.idWHERE main_recipes.id=(SELECT passed_id FROM passed_id)')
2025-08-10 08:56:10.432791 --- ERROR --- DatabaseError(message=''int' object does not support indexing',
                                         payload=4,
                                         sql='WITH passed_id AS (SELECT %s AS passed_id),    sum_cte AS (      SELECT mi.id, SUM(mil.quantity_on_hand)::FLOAT8 AS total_sum      FROM test_item_locations mil      JOIN test_items mi ON mil.part_id = mi.id      GROUP BY mi.id    ),    cte_recipe_items AS (            SELECT items.*,            /*COALESCE(test_items.barcode, items.uuid) AS uuid,*/            (SELECT COALESCE(row_to_json(units.*), '{}') FROM units WHERE units.id=test_item_info.uom) AS item_uom,            COALESCE(test_items.item_name, items.item_name) AS item_name,            COALESCE(test_items.links, items.links) AS links,            row_to_json(units.*) as uom,            (SELECT COALESCE(array_agg(jsonb_build_object('conversion', conv, 'unit', units)), '{}')                FROM test_conversions conv                LEFT JOIN units ON conv.uom_id = units.id                WHERE conv.item_id = test_items.id) AS conversions,            COALESCE(sum_cte.total_sum, 0.0) AS quantity_on_hand            FROM test_recipe_items items            LEFT JOIN test_items ON items.item_id = test_items.id            LEFT JOIN test_item_info ON test_items.item_info_id = test_item_info.id            LEFT JOIN units ON units.id =  items.uom            LEFT JOIN sum_cte ON test_items.id = sum_cte.id            WHERE items.rp_id = (SELECT passed_id FROM passed_id)            ORDER BY items.item_name ASC        )    SELECT (SELECT passed_id FROM passed_id) AS passed_id,     test_recipes.*,     logins.username as author,     (SELECT COALESCE(array_agg(row_to_json(ris)), '{}') FROM cte_recipe_items ris) AS recipe_itemsFROM test_recipesJOIN logins ON test_recipes.author = logins.idWHERE test_recipes.id=(SELECT passed_id FROM passed_id)')
2025-08-10 08:57:07.377357 --- ERROR --- DatabaseError(message=''int' object does not support indexing',
                                         payload=4,
                                         sql='WITH passed_id AS (SELECT %s AS passed_id),    sum_cte AS (      SELECT mi.id, SUM(mil.quantity_on_hand)::FLOAT8 AS total_sum      FROM test_item_locations mil      JOIN test_items mi ON mil.part_id = mi.id      GROUP BY mi.id    ),    cte_recipe_items AS (            SELECT items.*,            /*COALESCE(test_items.barcode, items.uuid) AS uuid,*/            (SELECT COALESCE(row_to_json(units.*), '{}') FROM units WHERE units.id=test_item_info.uom) AS item_uom,            COALESCE(test_items.item_name, items.item_name) AS item_name,            COALESCE(test_items.links, items.links) AS links,            row_to_json(units.*) as uom,            (SELECT COALESCE(array_agg(jsonb_build_object('conversion', conv, 'unit', units)), '{}')                FROM test_conversions conv                LEFT JOIN units ON conv.uom_id = units.id                WHERE conv.item_id = test_items.id) AS conversions,            COALESCE(sum_cte.total_sum, 0.0) AS quantity_on_hand            FROM test_recipe_items items            LEFT JOIN test_items ON items.item_id = test_items.id            LEFT JOIN test_item_info ON test_items.item_info_id = test_item_info.id            LEFT JOIN units ON units.id =  items.uom            LEFT JOIN sum_cte ON test_items.id = sum_cte.id            WHERE items.rp_id = (SELECT passed_id FROM passed_id)            ORDER BY items.item_name ASC        )    SELECT (SELECT passed_id FROM passed_id) AS passed_id,     test_recipes.*,     logins.username as author,     (SELECT COALESCE(array_agg(row_to_json(ris)), '{}') FROM cte_recipe_items ris) AS recipe_itemsFROM test_recipesJOIN logins ON test_recipes.author = logins.idWHERE test_recipes.id=(SELECT passed_id FROM passed_id)')
2025-08-10 08:57:32.169483 --- ERROR --- DatabaseError(message=''int' object does not support indexing',
                                         payload=4,
                                         sql='WITH passed_id AS (SELECT %s AS passed_id),    sum_cte AS (      SELECT mi.id, SUM(mil.quantity_on_hand)::FLOAT8 AS total_sum      FROM test_item_locations mil      JOIN test_items mi ON mil.part_id = mi.id      GROUP BY mi.id    ),    cte_recipe_items AS (            SELECT items.*,            /*COALESCE(test_items.barcode, items.uuid) AS uuid,*/            (SELECT COALESCE(row_to_json(units.*), '{}') FROM units WHERE units.id=test_item_info.uom) AS item_uom,            COALESCE(test_items.item_name, items.item_name) AS item_name,            COALESCE(test_items.links, items.links) AS links,            row_to_json(units.*) as uom,            (SELECT COALESCE(array_agg(jsonb_build_object('conversion', conv, 'unit', units)), '{}')                FROM test_conversions conv                LEFT JOIN units ON conv.uom_id = units.id                WHERE conv.item_id = test_items.id) AS conversions,            COALESCE(sum_cte.total_sum, 0.0) AS quantity_on_hand            FROM test_recipe_items items            LEFT JOIN test_items ON items.item_id = test_items.id            LEFT JOIN test_item_info ON test_items.item_info_id = test_item_info.id            LEFT JOIN units ON units.id =  items.uom            LEFT JOIN sum_cte ON test_items.id = sum_cte.id            WHERE items.rp_id = (SELECT passed_id FROM passed_id)            ORDER BY items.item_name ASC        )    SELECT (SELECT passed_id FROM passed_id) AS passed_id,     test_recipes.*,     logins.username as author,     (SELECT COALESCE(array_agg(row_to_json(ris)), '{}') FROM cte_recipe_items ris) AS recipe_itemsFROM test_recipesJOIN logins ON test_recipes.author = logins.idWHERE test_recipes.id=(SELECT passed_id FROM passed_id)')
2025-08-10 09:12:15.585887 --- ERROR --- DatabaseError(message='syntax error at or near "%"LINE 1: SELECT * FROM test_items items LEFT JOIN %site_name%_logisti...                                                 ^',
                                         payload=('44c41878-e645-4e16-a402-e480936ac4aa',),
                                         sql='SELECT * FROM test_items items LEFT JOIN %%site_name%%_logistics_info lginf ON lginf.id = items.logistics_info_id WHERE item_uuid=%s;')
2025-08-10 09:21:38.180067 --- ERROR --- DatabaseError(message='duplicate key value violates unique constraint "test_item_locations_part_id_location_id_key"DETAIL:  Key (part_id, location_id)=(2016, 2) already exists.',
                                         payload=(2016, 2, 0.0, '{}'),
                                         sql='INSERT INTO test_item_locations(part_id, location_id, quantity_on_hand, cost_layers) VALUES (%s, %s, %s, %s)RETURNING *;')
2025-08-10 09:26:25.470903 --- ERROR --- DatabaseError(message='syntax error at or near "{"LINE 1: SELECT items.*, lginf.* AS logistics_info FROM {site}_items ...                                                       ^',
                                         payload=('44c41878-e645-4e16-a402-e480936ac4aa',),
                                         sql='SELECT items.*, lginf.* AS logistics_info FROM {site}_items items LEFT JOIN {site}_logistics_info lginf ON lginf.id = items.logistics_info_id WHERE item_uuid=%s;')
2025-08-10 10:17:09.169270 --- ERROR --- DatabaseError(message='syntax error at or near ","LINE 1: ... test_conversions conversions WHERE part_id = 2016, uom_id =...                                                             ^',
                                         payload=(2016, 6),
                                         sql='SELECT conversions.conv_factor FROM test_conversions conversions WHERE part_id = %s, uom_id = %s;')
2025-08-10 10:18:03.658146 --- ERROR --- DatabaseError(message='column "part_id" does not existLINE 1: ...nv_factor FROM test_conversions conversions WHERE part_id = ...                                                             ^',
                                         payload=(2016, 6),
                                         sql='SELECT conversions.conv_factor FROM test_conversions conversions WHERE part_id = %s AND uom_id = %s;')
2025-08-10 11:11:24.348070 --- ERROR --- DatabaseError(message='duplicate key value violates unique constraint "test_logistics_info_barcode_key"DETAIL:  Key (barcode)=() already exists.',
                                         payload=('', 1, 1, 1, 1),
                                         sql='INSERT INTO test_logistics_info(barcode, primary_location, primary_zone, auto_issue_location, auto_issue_zone) VALUES (%s, %s, %s, %s, %s) RETURNING *;')
2025-08-10 19:30:16.195296 --- ERROR --- DatabaseError(message='duplicate key value violates unique constraint "test_logistics_info_barcode_key"DETAIL:  Key (barcode)=(%PLU0%) already exists.',
                                         payload=('%PLU0%', 1, 1, 1, 1),
                                         sql='INSERT INTO test_logistics_info(barcode, primary_location, primary_zone, auto_issue_location, auto_issue_zone) VALUES (%s, %s, %s, %s, %s) RETURNING *;')
2025-08-10 19:30:27.706841 --- ERROR --- DatabaseError(message='syntax error at or near "gen_random_uuid"LINE 3:     event_uuid UUID gen_random_uuid(),                            ^',
                                         payload=CREATE TABLE IF NOT EXISTS test_plan_events(
    id SERIAL PRIMARY KEY,
    event_uuid UUID gen_random_uuid(),
    plan_uuid UUID,
    event_shortname VARCHAR(32) NOT NULL,
    event_description TEXT,
    event_date TIMESTAMP NOT NULL,
    created_by INTEGER NOT NULL,
    UNIQUE(event_uuid)
)
,
                                         sql='plan_events')
2025-08-11 17:29:32.899829 --- ERROR --- DatabaseError(message='invalid input syntax for type uuid: ""LINE 3: VALUES ('', 'Mongolian Beef Noodles', 'test', '2025-08-04T00...                ^',
                                         payload=('', 'Mongolian Beef Noodles', 'test', datetime.datetime(2025, 8, 4, 0, 0), 1, '1cc556f6-48b6-459f-8a3e-072c6c69ce3a', 'recipe'),
                                         sql='INSERT INTO test_plan_events(plan_uuid, event_shortname, event_description, event_date, created_by, recipe_uuid, event_type) VALUES (%s, %s, %s, %s, %s, %s, %s) RETURNING *;')
2025-08-11 18:10:54.890311 --- ERROR --- DatabaseError(message='invalid input syntax for type uuid: ""LINE 3: ... WORK YAY!', '2025-08-07T00:00:00'::timestamp, 1, '', 'custo...                                                             ^',
                                         payload=(None, 'No Work', 'WE DONT HAVE WORK YAY!', datetime.datetime(2025, 8, 7, 0, 0), 1, '', 'custom'),
                                         sql='INSERT INTO test_plan_events(plan_uuid, event_shortname, event_description, event_date, created_by, recipe_uuid, event_type) VALUES (%s, %s, %s, %s, %s, %s, %s) RETURNING *;')
2025-08-11 18:47:53.328502 --- ERROR --- DatabaseError(message='relation "main_plan_events" does not existLINE 1: SELECT * FROM main_plan_events                      ^',
                                         payload=('2025', '8'),
                                         sql='SELECT * FROM main_plan_eventsWHERE EXTRACT(YEAR FROM event_date) = %s  AND EXTRACT(MONTH FROM event_date) = %s;')
2025-08-11 18:47:56.885307 --- ERROR --- DatabaseError(message='relation "main_plan_events" does not existLINE 1: SELECT * FROM main_plan_events                      ^',
                                         payload=('2025', '8'),
                                         sql='SELECT * FROM main_plan_eventsWHERE EXTRACT(YEAR FROM event_date) = %s  AND EXTRACT(MONTH FROM event_date) = %s;')
2025-08-11 18:48:24.644410 --- ERROR --- DatabaseError(message='relation "main_plan_events" does not existLINE 1: SELECT * FROM main_plan_events                      ^',
                                         payload=('2025', '8'),
                                         sql='SELECT * FROM main_plan_eventsWHERE EXTRACT(YEAR FROM event_date) = %s  AND EXTRACT(MONTH FROM event_date) = %s;')
2025-08-11 18:52:46.905608 --- ERROR --- DatabaseError(message='relation "main_plan_events" does not existLINE 1: SELECT * FROM main_plan_events                      ^',
                                         payload=('2025', '8'),
                                         sql='SELECT * FROM main_plan_eventsWHERE EXTRACT(YEAR FROM event_date) = %s  AND EXTRACT(MONTH FROM event_date) = %s;')
2025-08-11 18:53:54.266726 --- ERROR --- DatabaseError(message='relation "main_plan_events" does not existLINE 1: SELECT * FROM main_plan_events                      ^',
                                         payload=('2025', '8'),
                                         sql='SELECT * FROM main_plan_eventsWHERE EXTRACT(YEAR FROM event_date) = %s  AND EXTRACT(MONTH FROM event_date) = %s;')
2025-08-12 07:40:16.852940 --- ERROR --- DatabaseError(message='relation "main_plan_events" does not existLINE 1: SELECT * FROM main_plan_events                      ^',
                                         payload=('2025', '8'),
                                         sql='SELECT * FROM main_plan_eventsWHERE EXTRACT(YEAR FROM event_date) = %s  AND EXTRACT(MONTH FROM event_date) = %s;')
2025-08-12 08:43:31.049364 --- ERROR --- DatabaseError(message='invalid input syntax for type uuid: ""LINE 1: ...test 2', event_date = '2025-09-05', recipe_uuid = '', event_...                                                             ^',
                                         payload={'uuid': 'c703059d-d03d-4046-866a-64ebfad7f12c', 'update': {'event_shortname': 'Spicy Bacon Chilli', 'event_description': 'test 2', 'event_date': '2025-09-05', 'recipe_uuid': '', 'event_type': 'recipe'}},
                                         sql='UPDATE test_plan_events SET event_shortname = %s, event_description = %s, event_date = %s, recipe_uuid = %s, event_type = %s WHERE event_uuid=%s RETURNING *;')
2025-08-12 09:02:56.840495 --- ERROR --- DatabaseError(message='column "event_date" does not existLINE 2: WHERE EXTRACT(YEAR FROM event_date) = '2025'                                ^HINT:  Perhaps you meant to reference the column "test_plan_events.event_type".',
                                         payload=('2025', '8'),
                                         sql='SELECT * FROM test_plan_eventsWHERE EXTRACT(YEAR FROM event_date) = %s  AND EXTRACT(MONTH FROM event_date) = %s;')
2025-08-12 09:44:45.289711 --- ERROR --- DatabaseError(message='relation "main_plan_events" does not existLINE 1: SELECT * FROM main_plan_events                      ^',
                                         payload=('2025', '8'),
                                         sql='SELECT * FROM main_plan_eventsWHERE EXTRACT(YEAR FROM event_date_start) = %s  AND EXTRACT(MONTH FROM event_date_start) = %s;')
2025-08-12 09:44:49.727766 --- ERROR --- DatabaseError(message='relation "main_plan_events" does not existLINE 1: SELECT * FROM main_plan_events                      ^',
                                         payload=('2025', '8'),
                                         sql='SELECT * FROM main_plan_eventsWHERE EXTRACT(YEAR FROM event_date_start) = %s  AND EXTRACT(MONTH FROM event_date_start) = %s;')
2025-08-12 09:58:22.528782 --- ERROR --- DatabaseError(message='argument formats can't be mixed',
                                         payload=('2025', '8'),
                                         sql='/*SELECT * FROM test_plan_eventsWHERE EXTRACT(YEAR FROM event_date_start) = %s  AND EXTRACT(MONTH FROM event_date_start) = %s;  */SELECT *FROM test_plan_eventsWHERE event_date_start <= (MAKE_DATE(%(year)s, %(month)s, 1) + INTERVAL '1 month' - INTERVAL '1 day')::date  AND event_date_end   >= MAKE_DATE(%(year)s, %(month)s, 1)')
2025-08-12 10:02:49.084186 --- ERROR --- DatabaseError(message='tuple index out of range',
                                         payload=('2025', '8'),
                                         sql='/*SELECT * FROM test_plan_eventsWHERE EXTRACT(YEAR FROM event_date_start) = %s  AND EXTRACT(MONTH FROM event_date_start) = %s;  */SELECT *FROM test_plan_eventsWHERE event_date_start <= %s  AND event_date_end >= %s')
2025-08-12 10:03:17.111210 --- ERROR --- DatabaseError(message='invalid input syntax for type timestamp: "2025"LINE 5: WHERE event_date_start <= '2025'                                  ^',
                                         payload=('2025', '8'),
                                         sql='SELECT *FROM test_plan_eventsWHERE event_date_start <= %s  AND event_date_end >= %s')
2025-08-12 10:04:55.071530 --- ERROR --- DatabaseError(message='operator does not exist: numeric = dateLINE 2: WHERE EXTRACT(YEAR FROM event_date_start) = '2025-08-01'::da...                                                  ^HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.',
                                         payload=('2025', '8'),
                                         sql='SELECT * FROM test_plan_eventsWHERE EXTRACT(YEAR FROM event_date_start) = %s  AND EXTRACT(MONTH FROM event_date_start) = %s;')
2025-08-12 10:09:58.906650 --- ERROR --- DatabaseError(message='missing FROM-clause entry for table "arguments"LINE 4: WHERE EXTRACT(YEAR FROM event_date_start) = arguments.year                                                    ^',
                                         payload=('2025', '8'),
                                         sql='WITH arguments AS (SELECT %s AS year, %s AS month)SELECT * FROM test_plan_eventsWHERE EXTRACT(YEAR FROM event_date_start) = arguments.year  AND EXTRACT(MONTH FROM event_date_start) = arguments.month;')
2025-08-12 10:10:33.179512 --- ERROR --- DatabaseError(message='operator does not exist: numeric = textLINE 4: WHERE EXTRACT(YEAR FROM event_date_start) = (SELECT year FRO...                                                  ^HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.',
                                         payload=('2025', '8'),
                                         sql='WITH arguments AS (SELECT %s AS year, %s AS month)SELECT * FROM test_plan_eventsWHERE EXTRACT(YEAR FROM event_date_start) = (SELECT year FROM arguments)  AND EXTRACT(MONTH FROM event_date_start) = (SELECT month FROM arguments);')
2025-08-12 10:11:48.528557 --- ERROR --- DatabaseError(message='tuple index out of range',
                                         payload=('2025', '8'),
                                         sql='WITH arguments AS (SELECT %s AS year, %s AS month)WITH arguments AS (  SELECT %s AS year, %s AS month)SELECT *FROM test_plan_eventsWHERE  event_date_end >= make_date((SELECT year FROM arguments), (SELECT month FROM arguments), 1)  AND  event_date_start <  (make_date((SELECT year FROM arguments), (SELECT month FROM arguments), 1) + INTERVAL '1 month');')
2025-08-12 10:12:03.257652 --- ERROR --- DatabaseError(message='function make_date(text, text, integer) does not existLINE 7:   event_date_end >= make_date((SELECT year FROM arguments), ...                            ^HINT:  No function matches the given name and argument types. You might need to add explicit type casts.',
                                         payload=('2025', '8'),
                                         sql='WITH arguments AS (  SELECT %s AS year, %s AS month)SELECT *FROM test_plan_eventsWHERE  event_date_end >= make_date((SELECT year FROM arguments), (SELECT month FROM arguments), 1)  AND  event_date_start <  (make_date((SELECT year FROM arguments), (SELECT month FROM arguments), 1) + INTERVAL '1 month');')
2025-08-12 11:05:42.431102 --- ERROR --- DatabaseError(message='missing FROM-clause entry for table "main_brands"LINE 5:       COALESCE(row_to_json(main_brands.*), "{}") as recipe                                   ^',
                                         payload=(2025, 8),
                                         sql='WITH arguments AS (  SELECT %s AS year, %s AS month)SELECT events.*,      COALESCE(row_to_json(main_brands.*), "{}") as recipeFROM main_plan_events eventsLEFT JOIN main_recipes recipes ON recipes.recipe_uuid = events.recipe_uuidWHERE  event_date_end >= make_date((SELECT year FROM arguments), (SELECT month FROM arguments), 1)  AND  event_date_start <  (make_date((SELECT year FROM arguments), (SELECT month FROM arguments), 1) + INTERVAL '1 month');')
2025-08-12 11:05:56.643860 --- ERROR --- DatabaseError(message='column "{}" does not existLINE 5:       COALESCE(row_to_json(recipes.*), "{}") as recipe                                               ^',
                                         payload=(2025, 8),
                                         sql='WITH arguments AS (  SELECT %s AS year, %s AS month)SELECT events.*,      COALESCE(row_to_json(recipes.*), "{}") as recipeFROM main_plan_events eventsLEFT JOIN main_recipes recipes ON recipes.recipe_uuid = events.recipe_uuidWHERE  event_date_end >= make_date((SELECT year FROM arguments), (SELECT month FROM arguments), 1)  AND  event_date_start <  (make_date((SELECT year FROM arguments), (SELECT month FROM arguments), 1) + INTERVAL '1 month');')
2025-08-12 11:09:37.978621 --- ERROR --- DatabaseError(message='column g.rp_id does not existLINE 17: ..._to_json(g)), '{}') FROM cte_recipe_items g WHERE g.rp_id = ...                                                              ^',
                                         payload=(2025, 8),
                                         sql='WITH arguments AS (  SELECT %s AS year, %s AS month),sum_cte AS (      SELECT mi.item_uuid, SUM(mil.quantity_on_hand)::FLOAT8 AS total_sum      FROM main_item_locations mil      JOIN main_items mi ON mil.part_id = mi.id      GROUP BY mi.id    ),cte_recipe_items AS (        SELECT rp_item.qty, COALESCE(sum_cte.total_sum, 0) as quantity_on_hand FROM main_recipe_items rp_item        LEFT JOIN sum_cte ON sum_cte.item_uuid = rp_item.item_uuid    )SELECT events.*,      COALESCE(row_to_json(recipes.*), '{}') as recipe,      (SELECT COALESCE(array_agg(row_to_json(g)), '{}') FROM cte_recipe_items g WHERE g.rp_id = recipes.id) AS rp_itemsFROM main_plan_events eventsLEFT JOIN main_recipes recipes ON recipes.recipe_uuid = events.recipe_uuidWHERE  event_date_end >= make_date((SELECT year FROM arguments), (SELECT month FROM arguments), 1)  AND  event_date_start <  (make_date((SELECT year FROM arguments), (SELECT month FROM arguments), 1) + INTERVAL '1 month');')
2025-08-12 11:13:30.870202 --- ERROR --- DatabaseError(message='missing FROM-clause entry for table "recipe_missing_items"LINE 25:       COALESCE(recipe_missing_items.has_missing_ingredients,...                        ^',
                                         payload=(2025, 8),
                                         sql='WITH arguments AS (  SELECT %s AS year, %s AS month),sum_cte AS (      SELECT mi.item_uuid, SUM(mil.quantity_on_hand)::FLOAT8 AS total_sum      FROM main_item_locations mil      JOIN main_items mi ON mil.part_id = mi.id      GROUP BY mi.id    ),cte_recipe_items AS (        SELECT rp_item.rp_id, rp_item.qty, COALESCE(sum_cte.total_sum, 0) as quantity_on_hand FROM main_recipe_items rp_item        LEFT JOIN sum_cte ON sum_cte.item_uuid = rp_item.item_uuid    ), recipe_missing_items AS (  SELECT    rp_id,    bool_or(qty > quantity_on_hand) AS has_missing_ingredients  FROM cte_recipe_items  GROUP BY rp_id)SELECT events.*,      COALESCE(row_to_json(recipes.*), '{}') as recipe,      (SELECT COALESCE(array_agg(row_to_json(g)), '{}') FROM cte_recipe_items g WHERE g.rp_id = recipes.id) AS rp_items,      COALESCE(recipe_missing_items.has_missing_ingredients, FALSE) AS has_missing_ingredientsFROM main_plan_events eventsLEFT JOIN main_recipes recipes ON recipes.recipe_uuid = events.recipe_uuidWHERE  event_date_end >= make_date((SELECT year FROM arguments), (SELECT month FROM arguments), 1)  AND  event_date_start <  (make_date((SELECT year FROM arguments), (SELECT month FROM arguments), 1) + INTERVAL '1 month');')
2025-08-13 05:57:51.664542 --- ERROR --- DatabaseError(message='null value in column "barcode" of relation "main_logistics_info" violates not-null constraintDETAIL:  Failing row contains (489, null, 1, 1, 1, 1).',
                                         payload=(None, 1, 1, 1, 1),
                                         sql='INSERT INTO main_logistics_info(barcode, primary_location, primary_zone, auto_issue_location, auto_issue_zone) VALUES (%s, %s, %s, %s, %s) RETURNING *;')
2025-08-13 05:57:52.543637 --- ERROR --- DatabaseError(message='null value in column "barcode" of relation "main_logistics_info" violates not-null constraintDETAIL:  Failing row contains (490, null, 1, 1, 1, 1).',
                                         payload=(None, 1, 1, 1, 1),
                                         sql='INSERT INTO main_logistics_info(barcode, primary_location, primary_zone, auto_issue_location, auto_issue_zone) VALUES (%s, %s, %s, %s, %s) RETURNING *;')
2025-08-13 05:57:59.264995 --- ERROR --- DatabaseError(message='null value in column "barcode" of relation "main_logistics_info" violates not-null constraintDETAIL:  Failing row contains (491, null, 1, 1, 1, 1).',
                                         payload=(None, 1, 1, 1, 1),
                                         sql='INSERT INTO main_logistics_info(barcode, primary_location, primary_zone, auto_issue_location, auto_issue_zone) VALUES (%s, %s, %s, %s, %s) RETURNING *;')
2025-08-13 05:58:05.574433 --- ERROR --- DatabaseError(message='null value in column "barcode" of relation "main_logistics_info" violates not-null constraintDETAIL:  Failing row contains (492, null, 1, 1, 1, 1).',
                                         payload=(None, 1, 1, 1, 1),
                                         sql='INSERT INTO main_logistics_info(barcode, primary_location, primary_zone, auto_issue_location, auto_issue_zone) VALUES (%s, %s, %s, %s, %s) RETURNING *;')
2025-08-13 05:58:05.759833 --- ERROR --- DatabaseError(message='null value in column "barcode" of relation "main_logistics_info" violates not-null constraintDETAIL:  Failing row contains (493, null, 1, 1, 1, 1).',
                                         payload=(None, 1, 1, 1, 1),
                                         sql='INSERT INTO main_logistics_info(barcode, primary_location, primary_zone, auto_issue_location, auto_issue_zone) VALUES (%s, %s, %s, %s, %s) RETURNING *;')
2025-08-13 05:58:13.545144 --- ERROR --- DatabaseError(message='null value in column "barcode" of relation "main_logistics_info" violates not-null constraintDETAIL:  Failing row contains (494, null, 1, 1, 1, 1).',
                                         payload=(None, 1, 1, 1, 1),
                                         sql='INSERT INTO main_logistics_info(barcode, primary_location, primary_zone, auto_issue_location, auto_issue_zone) VALUES (%s, %s, %s, %s, %s) RETURNING *;')
2025-08-13 05:58:17.277887 --- ERROR --- DatabaseError(message='null value in column "barcode" of relation "main_logistics_info" violates not-null constraintDETAIL:  Failing row contains (495, null, 1, 1, 1, 1).',
                                         payload=(None, 1, 1, 1, 1),
                                         sql='INSERT INTO main_logistics_info(barcode, primary_location, primary_zone, auto_issue_location, auto_issue_zone) VALUES (%s, %s, %s, %s, %s) RETURNING *;')
2025-08-13 05:58:18.060764 --- ERROR --- DatabaseError(message='null value in column "barcode" of relation "main_logistics_info" violates not-null constraintDETAIL:  Failing row contains (496, null, 1, 1, 1, 1).',
                                         payload=(None, 1, 1, 1, 1),
                                         sql='INSERT INTO main_logistics_info(barcode, primary_location, primary_zone, auto_issue_location, auto_issue_zone) VALUES (%s, %s, %s, %s, %s) RETURNING *;')
2025-08-13 05:58:18.238774 --- ERROR --- DatabaseError(message='null value in column "barcode" of relation "main_logistics_info" violates not-null constraintDETAIL:  Failing row contains (497, null, 1, 1, 1, 1).',
                                         payload=(None, 1, 1, 1, 1),
                                         sql='INSERT INTO main_logistics_info(barcode, primary_location, primary_zone, auto_issue_location, auto_issue_zone) VALUES (%s, %s, %s, %s, %s) RETURNING *;')
2025-08-13 05:58:18.417773 --- ERROR --- DatabaseError(message='null value in column "barcode" of relation "main_logistics_info" violates not-null constraintDETAIL:  Failing row contains (498, null, 1, 1, 1, 1).',
                                         payload=(None, 1, 1, 1, 1),
                                         sql='INSERT INTO main_logistics_info(barcode, primary_location, primary_zone, auto_issue_location, auto_issue_zone) VALUES (%s, %s, %s, %s, %s) RETURNING *;')
2025-08-13 05:58:21.253662 --- ERROR --- DatabaseError(message='null value in column "barcode" of relation "main_logistics_info" violates not-null constraintDETAIL:  Failing row contains (499, null, 1, 1, 1, 1).',
                                         payload=(None, 1, 1, 1, 1),
                                         sql='INSERT INTO main_logistics_info(barcode, primary_location, primary_zone, auto_issue_location, auto_issue_zone) VALUES (%s, %s, %s, %s, %s) RETURNING *;')
2025-08-13 05:58:21.412016 --- ERROR --- DatabaseError(message='null value in column "barcode" of relation "main_logistics_info" violates not-null constraintDETAIL:  Failing row contains (500, null, 1, 1, 1, 1).',
                                         payload=(None, 1, 1, 1, 1),
                                         sql='INSERT INTO main_logistics_info(barcode, primary_location, primary_zone, auto_issue_location, auto_issue_zone) VALUES (%s, %s, %s, %s, %s) RETURNING *;')
2025-08-13 05:58:49.785521 --- ERROR --- DatabaseError(message='null value in column "barcode" of relation "main_logistics_info" violates not-null constraintDETAIL:  Failing row contains (501, null, 1, 1, 1, 1).',
                                         payload=(None, 1, 1, 1, 1),
                                         sql='INSERT INTO main_logistics_info(barcode, primary_location, primary_zone, auto_issue_location, auto_issue_zone) VALUES (%s, %s, %s, %s, %s) RETURNING *;')
2025-08-13 05:58:54.323920 --- ERROR --- DatabaseError(message='null value in column "barcode" of relation "main_logistics_info" violates not-null constraintDETAIL:  Failing row contains (502, null, 1, 1, 1, 1).',
                                         payload=(None, 1, 1, 1, 1),
                                         sql='INSERT INTO main_logistics_info(barcode, primary_location, primary_zone, auto_issue_location, auto_issue_zone) VALUES (%s, %s, %s, %s, %s) RETURNING *;')
2025-08-13 05:58:54.795245 --- ERROR --- DatabaseError(message='null value in column "barcode" of relation "main_logistics_info" violates not-null constraintDETAIL:  Failing row contains (503, null, 1, 1, 1, 1).',
                                         payload=(None, 1, 1, 1, 1),
                                         sql='INSERT INTO main_logistics_info(barcode, primary_location, primary_zone, auto_issue_location, auto_issue_zone) VALUES (%s, %s, %s, %s, %s) RETURNING *;')
2025-08-13 05:58:54.964411 --- ERROR --- DatabaseError(message='null value in column "barcode" of relation "main_logistics_info" violates not-null constraintDETAIL:  Failing row contains (504, null, 1, 1, 1, 1).',
                                         payload=(None, 1, 1, 1, 1),
                                         sql='INSERT INTO main_logistics_info(barcode, primary_location, primary_zone, auto_issue_location, auto_issue_zone) VALUES (%s, %s, %s, %s, %s) RETURNING *;')
2025-08-13 05:58:55.098509 --- ERROR --- DatabaseError(message='null value in column "barcode" of relation "main_logistics_info" violates not-null constraintDETAIL:  Failing row contains (505, null, 1, 1, 1, 1).',
                                         payload=(None, 1, 1, 1, 1),
                                         sql='INSERT INTO main_logistics_info(barcode, primary_location, primary_zone, auto_issue_location, auto_issue_zone) VALUES (%s, %s, %s, %s, %s) RETURNING *;')
2025-08-13 05:58:56.160562 --- ERROR --- DatabaseError(message='null value in column "barcode" of relation "main_logistics_info" violates not-null constraintDETAIL:  Failing row contains (506, null, 1, 1, 1, 1).',
                                         payload=(None, 1, 1, 1, 1),
                                         sql='INSERT INTO main_logistics_info(barcode, primary_location, primary_zone, auto_issue_location, auto_issue_zone) VALUES (%s, %s, %s, %s, %s) RETURNING *;')
2025-08-13 05:58:56.248810 --- ERROR --- DatabaseError(message='null value in column "barcode" of relation "main_logistics_info" violates not-null constraintDETAIL:  Failing row contains (507, null, 1, 1, 1, 1).',
                                         payload=(None, 1, 1, 1, 1),
                                         sql='INSERT INTO main_logistics_info(barcode, primary_location, primary_zone, auto_issue_location, auto_issue_zone) VALUES (%s, %s, %s, %s, %s) RETURNING *;')
2025-08-13 05:59:00.781015 --- ERROR --- DatabaseError(message='null value in column "barcode" of relation "main_logistics_info" violates not-null constraintDETAIL:  Failing row contains (508, null, 1, 1, 1, 1).',
                                         payload=(None, 1, 1, 1, 1),
                                         sql='INSERT INTO main_logistics_info(barcode, primary_location, primary_zone, auto_issue_location, auto_issue_zone) VALUES (%s, %s, %s, %s, %s) RETURNING *;')
2025-08-13 05:59:01.156483 --- ERROR --- DatabaseError(message='null value in column "barcode" of relation "main_logistics_info" violates not-null constraintDETAIL:  Failing row contains (509, null, 1, 1, 1, 1).',
                                         payload=(None, 1, 1, 1, 1),
                                         sql='INSERT INTO main_logistics_info(barcode, primary_location, primary_zone, auto_issue_location, auto_issue_zone) VALUES (%s, %s, %s, %s, %s) RETURNING *;')
2025-08-13 05:59:01.352075 --- ERROR --- DatabaseError(message='null value in column "barcode" of relation "main_logistics_info" violates not-null constraintDETAIL:  Failing row contains (510, null, 1, 1, 1, 1).',
                                         payload=(None, 1, 1, 1, 1),
                                         sql='INSERT INTO main_logistics_info(barcode, primary_location, primary_zone, auto_issue_location, auto_issue_zone) VALUES (%s, %s, %s, %s, %s) RETURNING *;')
2025-08-13 14:48:16.893199 --- ERROR --- DatabaseError(message='null value in column "barcode" of relation "main_logistics_info" violates not-null constraintDETAIL:  Failing row contains (511, null, 1, 1, 1, 1).',
                                         payload=(None, 1, 1, 1, 1),
                                         sql='INSERT INTO main_logistics_info(barcode, primary_location, primary_zone, auto_issue_location, auto_issue_zone) VALUES (%s, %s, %s, %s, %s) RETURNING *;')
2025-08-13 18:11:37.556015 --- ERROR --- DatabaseError(message='missing FROM-clause entry for table "recipes"LINE 1: SELECT COUNT(*) FROM main_recipes WHERE recipes.name LIKE '%...                                                ^',
                                         payload=('', 25, 0),
                                         sql='SELECT recipes.recipe_uuid, recipes.name FROM main_recipes recipes WHERE recipes.name LIKE '%%' || %s || '%%' LIMIT %s OFFSET %s;')
2025-08-13 18:13:39.194633 --- ERROR --- DatabaseError(message='missing FROM-clause entry for table "recipes"LINE 1: SELECT COUNT(*) FROM main_recipes WHERE recipes.name LIKE '%...                                                ^',
                                         payload=('', 25, 0),
                                         sql='SELECT * FROM main_recipes recipes WHERE recipes.name LIKE '%%' || %s || '%%' LIMIT %s OFFSET %s;')
2025-08-14 15:19:00.050654 --- ERROR --- DatabaseError(message='column "sl_id" does not existLINE 2: ...(g)), '{}') FROM test_shopping_list_items g WHERE sl_id = te...                                                             ^',
                                         payload=(5, 0),
                                         sql='SELECT *,    (SELECT COALESCE(array_agg(row_to_json(g)), '{}') FROM test_shopping_list_items g WHERE sl_id = test_shopping_lists.id) AS sl_items FROM test_shopping_lists LIMIT %s OFFSET %s;')
2025-08-14 15:25:02.157300 --- ERROR --- DatabaseError(message='column items.sl_id does not existLINE 6:             WHERE items.sl_id = (SELECT passed_id FROM passe...                          ^',
                                         payload=(12,),
                                         sql='WITH passed_id AS (SELECT %s AS passed_id),    cte_sl_items AS (            SELECT items.*,             (SELECT COALESCE(row_to_json(un), '{}') FROM units un WHERE un.id = items.uom LIMIT 1) AS uom            FROM test_shopping_list_items items            WHERE items.sl_id = (SELECT passed_id FROM passed_id)        )SELECT (SELECT passed_id FROM passed_id) AS passed_id,     test_shopping_lists.*,     logins.username as author,     (SELECT COALESCE(array_agg(row_to_json(slis)), '{}') FROM cte_sl_items slis) AS sl_items  FROM test_shopping_listsJOIN logins ON test_shopping_lists.author = logins.idWHERE test_shopping_lists.id=(SELECT passed_id FROM passed_id)')
2025-08-14 15:28:59.416536 --- ERROR --- DatabaseError(message='operator does not exist: uuid = integerLINE 6:             WHERE items.list_uuid = (SELECT passed_uuid FROM...                                          ^HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.',
                                         payload=(12,),
                                         sql='WITH passed_uuid AS (SELECT %s AS passed_uuid),    cte_sl_items AS (            SELECT items.*,             (SELECT COALESCE(row_to_json(un), '{}') FROM units un WHERE un.id = items.uom LIMIT 1) AS uom            FROM test_shopping_list_items items            WHERE items.list_uuid = (SELECT passed_uuid FROM passed_uuid)        )SELECT (SELECT passed_uuid FROM passed_uuid) AS passed_uuid,     test_shopping_lists.*,     logins.username as author,     (SELECT COALESCE(array_agg(row_to_json(slis)), '{}') FROM cte_sl_items slis) AS sl_items  FROM test_shopping_listsJOIN logins ON test_shopping_lists.author = logins.idWHERE test_shopping_lists.list_uuid=(SELECT passed_uuid FROM passed_uuid)')
2025-08-14 15:29:26.536839 --- ERROR --- DatabaseError(message='operator does not exist: uuid = integerLINE 6:             WHERE items.list_uuid = (SELECT passed_uuid FROM...                                          ^HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.',
                                         payload=(2,),
                                         sql='WITH passed_uuid AS (SELECT %s AS passed_uuid),    cte_sl_items AS (            SELECT items.*,             (SELECT COALESCE(row_to_json(un), '{}') FROM units un WHERE un.id = items.uom LIMIT 1) AS uom            FROM test_shopping_list_items items            WHERE items.list_uuid = (SELECT passed_uuid FROM passed_uuid)        )SELECT (SELECT passed_uuid FROM passed_uuid) AS passed_uuid,     test_shopping_lists.*,     logins.username as author,     (SELECT COALESCE(array_agg(row_to_json(slis)), '{}') FROM cte_sl_items slis) AS sl_items  FROM test_shopping_listsJOIN logins ON test_shopping_lists.author = logins.idWHERE test_shopping_lists.list_uuid=(SELECT passed_uuid FROM passed_uuid)')
2025-08-14 15:32:23.856954 --- ERROR --- DatabaseError(message='operator does not exist: uuid = textLINE 6:             WHERE items.list_uuid = (SELECT passed_uuid FROM...                                          ^HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.',
                                         payload=('14d8ce2f-2920-47ae-a671-2953d567383d',),
                                         sql='WITH passed_uuid AS (SELECT %s AS passed_uuid),    cte_sl_items AS (            SELECT items.*,             (SELECT COALESCE(row_to_json(un), '{}') FROM units un WHERE un.id = items.uom LIMIT 1) AS uom            FROM test_shopping_list_items items            WHERE items.list_uuid = (SELECT passed_uuid FROM passed_uuid)        )SELECT (SELECT passed_uuid FROM passed_uuid) AS passed_uuid,     test_shopping_lists.*,     logins.username as author,     (SELECT COALESCE(array_agg(row_to_json(slis)), '{}') FROM cte_sl_items slis) AS sl_items  FROM test_shopping_listsJOIN logins ON test_shopping_lists.author = logins.idWHERE test_shopping_lists.list_uuid=(SELECT passed_uuid FROM passed_uuid)')
2025-08-14 15:34:21.586465 --- ERROR --- DatabaseError(message='operator does not exist: uuid = textLINE 6:             WHERE items.list_uuid = (SELECT passed_uuid FROM...                                          ^HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.',
                                         payload=('14d8ce2f-2920-47ae-a671-2953d567383d',),
                                         sql='WITH passed_uuid AS (SELECT %s AS passed_uuid),    cte_sl_items AS (            SELECT items.*,             (SELECT COALESCE(row_to_json(un), '{}') FROM units un WHERE un.id = items.uom LIMIT 1) AS uom            FROM test_shopping_list_items items            WHERE items.list_uuid = (SELECT passed_uuid FROM passed_uuid)        )SELECT (SELECT passed_uuid FROM passed_uuid) AS passed_uuid,     test_shopping_lists.*,     logins.username as author,     (SELECT COALESCE(array_agg(row_to_json(slis)), '{}') FROM cte_sl_items slis) AS sl_items  FROM test_shopping_listsJOIN logins ON test_shopping_lists.author = logins.idWHERE test_shopping_lists.list_uuid=(SELECT passed_uuid FROM passed_uuid)')
2025-08-14 16:30:42.515423 --- ERROR --- DatabaseError(message='column "id" does not existLINE 1: ...ws AS (DELETE FROM test_shopping_list_items WHERE id IN ('e9...                                                             ^',
                                         payload=('e9c4ff4f-0dad-444d-a8ba-525360b14f2b',),
                                         sql='WITH deleted_rows AS (DELETE FROM test_shopping_list_items WHERE id IN (%s) RETURNING *) SELECT * FROM deleted_rows;')
2025-08-14 16:31:21.076149 --- ERROR --- DatabaseError(message='column "list_item_uud" does not existLINE 1: ...ws AS (DELETE FROM test_shopping_list_items WHERE list_item_...                                                             ^HINT:  Perhaps you meant to reference the column "test_shopping_list_items.list_item_uuid".',
                                         payload=('e9c4ff4f-0dad-444d-a8ba-525360b14f2b',),
                                         sql='WITH deleted_rows AS (DELETE FROM test_shopping_list_items WHERE list_item_uud IN (%s) RETURNING *) SELECT * FROM deleted_rows;')
2025-08-14 16:32:02.625093 --- ERROR --- DatabaseError(message='column test_shopping_list_items.list_item_uud does not existLINE 1: ...ws AS (DELETE FROM test_shopping_list_items WHERE test_shopp...                                                             ^HINT:  Perhaps you meant to reference the column "test_shopping_list_items.list_item_uuid".',
                                         payload=('e9c4ff4f-0dad-444d-a8ba-525360b14f2b',),
                                         sql='WITH deleted_rows AS (DELETE FROM test_shopping_list_items WHERE test_shopping_list_items.list_item_uud IN (%s) RETURNING *) SELECT * FROM deleted_rows;')
2025-08-14 16:33:56.856394 --- ERROR --- DatabaseError(message='cannot cast type integer to uuidLINE 4: WHERE items.list_item_uuid = 1::uuid;                                       ^',
                                         payload=(1,),
                                         sql='SELECT items.*,     (SELECT COALESCE(row_to_json(un), '{}') FROM units un WHERE un.id = items.uom LIMIT 1) AS uomFROM test_shopping_list_items itemsWHERE items.list_item_uuid = %s::uuid; ')
2025-08-14 16:36:03.309409 --- ERROR --- DatabaseError(message='invalid input syntax for type uuid: ""LINE 4: WHERE items.list_item_uuid = ''::uuid;                                      ^',
                                         payload=('',),
                                         sql='SELECT items.*,     (SELECT COALESCE(row_to_json(un), '{}') FROM units un WHERE un.id = items.uom LIMIT 1) AS uomFROM test_shopping_list_items itemsWHERE items.list_item_uuid = %s::uuid; ')
2025-08-14 16:44:56.545542 --- ERROR --- DatabaseError(message='duplicate key value violates unique constraint "unique combo"DETAIL:  Key (item_name, list_uuid)=(Whole grain oats, 14d8ce2f-2920-47ae-a671-2953d567383d) already exists.',
                                         payload=('14d8ce2f-2920-47ae-a671-2953d567383d', 'sku', 'Whole grain oats', 1, 1, '9b93104e-4df3-47c4-9d56-f75548ed2c6c', '{}'),
                                         sql='INSERT INTO test_shopping_list_items(list_uuid, item_type, item_name, uom, qty, item_uuid, links) VALUES (%s, %s, %s, %s, %s, %s, %s) RETURNING *;')
2025-08-14 16:55:30.428449 --- ERROR --- DatabaseError(message='column recipes.recipe_uuid does not existLINE 3: WHERE recipes.recipe_uuid = 'ab60ddfa-90ab-4ce0-9c98-a505873...              ^',
                                         payload=('ab60ddfa-90ab-4ce0-9c98-a505873788bd',),
                                         sql='SELECT * FROM test_recipe_items recipesWHERE recipes.recipe_uuid = %s::uuid;')
2025-08-14 17:00:16.133750 --- ERROR --- DatabaseError(message='syntax error at or near ":"LINE 1: ....recipe_uuid = 'ab60ddfa-90ab-4ce0-9c98-a505873788bd':uuid),                                                                ^',
                                         payload=('ab60ddfa-90ab-4ce0-9c98-a505873788bd',),
                                         sql='WITH passed_id AS (SELECT recipe.id AS passed_id FROM test_recipes recipes WHERE recipes.recipe_uuid = %s:uuid),    sum_cte AS (      SELECT mi.id, SUM(mil.quantity_on_hand)::FLOAT8 AS total_sum      FROM test_item_locations mil      JOIN test_items mi ON mil.part_id = mi.id      GROUP BY mi.id    ),    cte_recipe_items AS (            SELECT items.*,            /*COALESCE(test_items.barcode, items.uuid) AS uuid,*/            (SELECT COALESCE(row_to_json(units.*), '{}') FROM units WHERE units.id=test_item_info.uom) AS item_uom,            COALESCE(test_items.item_name, items.item_name) AS item_name,            COALESCE(test_items.links, items.links) AS links,            row_to_json(units.*) as uom,            (SELECT COALESCE(array_agg(jsonb_build_object('conversion', conv, 'unit', units)), '{}')                FROM test_conversions conv                LEFT JOIN units ON conv.uom_id = units.id                WHERE conv.item_id = test_items.id) AS conversions,            COALESCE(sum_cte.total_sum, 0.0) AS quantity_on_hand            FROM test_recipe_items items            LEFT JOIN test_items ON items.item_id = test_items.id            LEFT JOIN test_item_info ON test_items.item_info_id = test_item_info.id            LEFT JOIN units ON units.id =  items.uom            LEFT JOIN sum_cte ON test_items.id = sum_cte.id            WHERE items.rp_id = (SELECT passed_id FROM passed_id)            ORDER BY items.item_name ASC        )    SELECT (SELECT passed_id FROM passed_id) AS passed_id,     test_recipes.*,     logins.username as author,     (SELECT COALESCE(array_agg(row_to_json(ris)), '{}') FROM cte_recipe_items ris) AS recipe_itemsFROM test_recipesJOIN logins ON test_recipes.author = logins.idWHERE test_recipes.id=(SELECT passed_id FROM passed_id)')
2025-08-14 17:00:42.565091 --- ERROR --- DatabaseError(message='missing FROM-clause entry for table "recipe"LINE 1: WITH passed_id AS (SELECT recipe.id AS passed_id FROM test_r...                                  ^',
                                         payload=('ab60ddfa-90ab-4ce0-9c98-a505873788bd',),
                                         sql='WITH passed_id AS (SELECT recipe.id AS passed_id FROM test_recipes recipes WHERE recipes.recipe_uuid = %s::uuid),    sum_cte AS (      SELECT mi.id, SUM(mil.quantity_on_hand)::FLOAT8 AS total_sum      FROM test_item_locations mil      JOIN test_items mi ON mil.part_id = mi.id      GROUP BY mi.id    ),    cte_recipe_items AS (            SELECT items.*,            /*COALESCE(test_items.barcode, items.uuid) AS uuid,*/            (SELECT COALESCE(row_to_json(units.*), '{}') FROM units WHERE units.id=test_item_info.uom) AS item_uom,            COALESCE(test_items.item_name, items.item_name) AS item_name,            COALESCE(test_items.links, items.links) AS links,            row_to_json(units.*) as uom,            (SELECT COALESCE(array_agg(jsonb_build_object('conversion', conv, 'unit', units)), '{}')                FROM test_conversions conv                LEFT JOIN units ON conv.uom_id = units.id                WHERE conv.item_id = test_items.id) AS conversions,            COALESCE(sum_cte.total_sum, 0.0) AS quantity_on_hand            FROM test_recipe_items items            LEFT JOIN test_items ON items.item_id = test_items.id            LEFT JOIN test_item_info ON test_items.item_info_id = test_item_info.id            LEFT JOIN units ON units.id =  items.uom            LEFT JOIN sum_cte ON test_items.id = sum_cte.id            WHERE items.rp_id = (SELECT passed_id FROM passed_id)            ORDER BY items.item_name ASC        )    SELECT (SELECT passed_id FROM passed_id) AS passed_id,     test_recipes.*,     logins.username as author,     (SELECT COALESCE(array_agg(row_to_json(ris)), '{}') FROM cte_recipe_items ris) AS recipe_itemsFROM test_recipesJOIN logins ON test_recipes.author = logins.idWHERE test_recipes.id=(SELECT passed_id FROM passed_id)')
2025-08-14 17:03:48.785824 --- ERROR --- DatabaseError(message='syntax error at or near "SELECT"LINE 2: SELECT (SELECT passed_id FROM passed_id) AS passed_id,        ^',
                                         payload=('ab60ddfa-90ab-4ce0-9c98-a505873788bd',),
                                         sql='WITH passed_id AS (SELECT recipes.id AS passed_id FROM test_recipes recipes WHERE recipes.recipe_uuid = %s::uuid),SELECT (SELECT passed_id FROM passed_id) AS passed_id,     recipe_items.*,FROM test_recipe_items recipe_itemsWHERE test_recipes.id=(SELECT passed_id FROM passed_id);')
2025-08-14 17:04:26.545601 --- ERROR --- DatabaseError(message='syntax error at or near "SELECT"LINE 2: SELECT (SELECT passed_id FROM passed_id) AS passed_id,        ^',
                                         payload=('ab60ddfa-90ab-4ce0-9c98-a505873788bd',),
                                         sql='WITH passed_id AS (SELECT recipes.id AS passed_id FROM test_recipes recipes WHERE recipes.recipe_uuid = %s::uuid),SELECT (SELECT passed_id FROM passed_id) AS passed_id,     recipe_items.*FROM test_recipe_items recipe_itemsWHERE test_recipes.id=(SELECT passed_id FROM passed_id);')
2025-08-14 17:04:43.018584 --- ERROR --- DatabaseError(message='missing FROM-clause entry for table "test_recipes"LINE 5: WHERE test_recipes.id=(SELECT passed_id FROM passed_id);              ^',
                                         payload=('ab60ddfa-90ab-4ce0-9c98-a505873788bd',),
                                         sql='WITH passed_id AS (SELECT recipes.id AS passed_id FROM test_recipes recipes WHERE recipes.recipe_uuid = %s::uuid)SELECT (SELECT passed_id FROM passed_id) AS passed_id,     recipe_items.*FROM test_recipe_items recipe_itemsWHERE test_recipes.id=(SELECT passed_id FROM passed_id);')
2025-08-14 17:13:12.481521 --- ERROR --- DatabaseError(message='syntax error at or near "FROM"LINE 7: FROM test_recipe_items recipe_items        ^',
                                         payload=('ab60ddfa-90ab-4ce0-9c98-a505873788bd',),
                                         sql='WITH passed_id AS (SELECT recipes.id AS passed_id FROM test_recipes recipes WHERE recipes.recipe_uuid = %s::uuid)SELECT     COALESCE(item_info.uom, recipe_items.uom) as uom,     COALESCE(items.links, recipe_items.links) as links,     items.item_uuid,     items.item_name,FROM test_recipe_items recipe_itemsLEFT JOIN test_items items ON items.item_uuid = recipe_items.item_uuidLEFT JOIN test_item_info item_info ON item_info.id = items.item_info_idWHERE recipe_items.rp_id=(SELECT passed_id FROM passed_id);')
2025-08-14 17:15:03.135511 --- ERROR --- DatabaseError(message='COALESCE types character varying and integer cannot be matchedLINE 3:      COALESCE(units.fullname, recipe_items.uom) as uom,                                      ^',
                                         payload=('ab60ddfa-90ab-4ce0-9c98-a505873788bd',),
                                         sql='WITH passed_id AS (SELECT recipes.id AS passed_id FROM test_recipes recipes WHERE recipes.recipe_uuid = %s::uuid)SELECT     COALESCE(units.fullname, recipe_items.uom) as uom,     COALESCE(items.links, recipe_items.links) as links,     items.item_uuid,     items.item_nameFROM test_recipe_items recipe_itemsLEFT JOIN test_items items ON items.item_uuid = recipe_items.item_uuidLEFT JOIN test_item_info item_info ON item_info.id = items.item_info_idLEFT JOIN units ON units.id = item_info.uomWHERE recipe_items.rp_id=(SELECT passed_id FROM passed_id);')
2025-08-14 17:16:24.328017 --- ERROR --- DatabaseError(message='COALESCE types character varying and integer cannot be matchedLINE 3: ...ullname FROM units WHERE units.id=item_info.uom), recipe_ite...                                                             ^',
                                         payload=('ab60ddfa-90ab-4ce0-9c98-a505873788bd',),
                                         sql='WITH passed_id AS (SELECT recipes.id AS passed_id FROM test_recipes recipes WHERE recipes.recipe_uuid = %s::uuid)SELECT     COALESCE((SELECT units.fullname FROM units WHERE units.id=item_info.uom), recipe_items.uom) as uom,     COALESCE(items.links, recipe_items.links) as links,     items.item_uuid,     items.item_nameFROM test_recipe_items recipe_itemsLEFT JOIN test_items items ON items.item_uuid = recipe_items.item_uuidLEFT JOIN test_item_info item_info ON item_info.id = items.item_info_idWHERE recipe_items.rp_id=(SELECT passed_id FROM passed_id);')
2025-08-14 17:23:17.559471 --- ERROR --- DatabaseError(message='null value in column "item_name" of relation "test_shopping_list_items" violates not-null constraintDETAIL:  Failing row contains (recipe, null, 1, 55, {"main": "1"}, f3571bbb-25d3-4b9d-aafd-6be67a289068, null, 14d8ce2f-2920-47ae-a671-2953d567383d).',
                                         payload=('14d8ce2f-2920-47ae-a671-2953d567383d', 'recipe', None, 1, 55.0, None, '{"main": "1"}'),
                                         sql='INSERT INTO test_shopping_list_items(list_uuid, item_type, item_name, uom, qty, item_uuid, links) VALUES (%s, %s, %s, %s, %s, %s, %s) RETURNING *;')
2025-08-14 17:30:27.390620 --- ERROR --- DatabaseError(message='duplicate key value violates unique constraint "unique combo"DETAIL:  Key (item_name, list_uuid)=(Torani Peppermint syrup, ad3bfe0d-3442-42fa-af16-08a6fc0a1c33) already exists.',
                                         payload=('ad3bfe0d-3442-42fa-af16-08a6fc0a1c33', 'recipe', 'Torani Peppermint syrup', 1, 1.0, '53d52046-8e70-4451-89fb-200de48ae6d0', '{}'),
                                         sql='INSERT INTO test_shopping_list_items(list_uuid, item_type, item_name, uom, qty, item_uuid, links) VALUES (%s, %s, %s, %s, %s, %s, %s) RETURNING *;')
2025-08-14 17:48:08.287394 --- ERROR --- DatabaseError(message='column excluded.col2 does not existLINE 5: SET qty = test_shopping_list_items.qty + EXCLUDED.col2                                                 ^',
                                         payload=('ad3bfe0d-3442-42fa-af16-08a6fc0a1c33', 'recipe', 'Torani Peppermint syrup', 1, 1.0, '53d52046-8e70-4451-89fb-200de48ae6d0', '{}'),
                                         sql='INSERT INTO test_shopping_list_items(list_uuid, item_type, item_name, uom, qty, item_uuid, links) VALUES (%s, %s, %s, %s, %s, %s, %s)ON CONFLICT (list_uuid, item_name) DO UPDATESET qty = test_shopping_list_items.qty + EXCLUDED.col2RETURNING *;')
2025-08-14 17:58:26.999337 --- ERROR --- DatabaseError(message='invalid input syntax for type uuid: "target='_blank'"',
                                         payload=("target='_blank'",),
                                         sql='WITH passed_uuid AS (SELECT %s AS passed_uuid),    cte_sl_items AS (            SELECT items.*,             (SELECT COALESCE(row_to_json(un), '{}') FROM units un WHERE un.id = items.uom LIMIT 1) AS uom            FROM test_shopping_list_items items            WHERE items.list_uuid = (SELECT passed_uuid::uuid FROM passed_uuid)        )SELECT (SELECT passed_uuid FROM passed_uuid) AS passed_uuid,     test_shopping_lists.*,     logins.username as author,     (SELECT COALESCE(array_agg(row_to_json(slis)), '{}') FROM cte_sl_items slis) AS sl_items  FROM test_shopping_listsJOIN logins ON test_shopping_lists.author = logins.idWHERE test_shopping_lists.list_uuid=(SELECT passed_uuid::uuid FROM passed_uuid)')
2025-08-14 17:58:32.904639 --- ERROR --- DatabaseError(message='invalid input syntax for type uuid: "target='_blank'"',
                                         payload=("target='_blank'",),
                                         sql='WITH passed_uuid AS (SELECT %s AS passed_uuid),    cte_sl_items AS (            SELECT items.*,             (SELECT COALESCE(row_to_json(un), '{}') FROM units un WHERE un.id = items.uom LIMIT 1) AS uom            FROM test_shopping_list_items items            WHERE items.list_uuid = (SELECT passed_uuid::uuid FROM passed_uuid)        )SELECT (SELECT passed_uuid FROM passed_uuid) AS passed_uuid,     test_shopping_lists.*,     logins.username as author,     (SELECT COALESCE(array_agg(row_to_json(slis)), '{}') FROM cte_sl_items slis) AS sl_items  FROM test_shopping_listsJOIN logins ON test_shopping_lists.author = logins.idWHERE test_shopping_lists.list_uuid=(SELECT passed_uuid::uuid FROM passed_uuid)')
2025-08-14 17:58:36.459552 --- ERROR --- DatabaseError(message='invalid input syntax for type uuid: "1"',
                                         payload=('1',),
                                         sql='WITH passed_uuid AS (SELECT %s AS passed_uuid),    cte_sl_items AS (            SELECT items.*,             (SELECT COALESCE(row_to_json(un), '{}') FROM units un WHERE un.id = items.uom LIMIT 1) AS uom            FROM test_shopping_list_items items            WHERE items.list_uuid = (SELECT passed_uuid::uuid FROM passed_uuid)        )SELECT (SELECT passed_uuid FROM passed_uuid) AS passed_uuid,     test_shopping_lists.*,     logins.username as author,     (SELECT COALESCE(array_agg(row_to_json(slis)), '{}') FROM cte_sl_items slis) AS sl_items  FROM test_shopping_listsJOIN logins ON test_shopping_lists.author = logins.idWHERE test_shopping_lists.list_uuid=(SELECT passed_uuid::uuid FROM passed_uuid)')
2025-08-14 18:14:47.690481 --- ERROR --- DatabaseError(message='relation "cte_item_info" does not existLINE 8:     (SELECT COALESCE(row_to_json(ii), '{}') FROM cte_item_in...                                                         ^',
                                         payload=None,
                                         sql='WITH sum_cte AS (  SELECT mi.id, SUM(mil.quantity_on_hand) AS total_sum  FROM main_item_locations mil  JOIN main_items mi ON mil.part_id = mi.id  GROUP BY mi.id)SELECT main_items.*,    (SELECT COALESCE(row_to_json(ii), '{}') FROM cte_item_info ii) AS item_infoFROM main_itemsLEFT JOIN main_item_info ON main_items.item_info_id = main_item_info.idLEFT JOIN units ON units.id = main_item_info.uomLEFT JOIN sum_cte ON main_items.id = sum_cte.idWHERE main_item_info.safety_stock > COALESCE(sum_cte.total_sum, 0);')
2025-08-14 18:15:24.034419 --- ERROR --- DatabaseError(message='missing FROM-clause entry for table "item_info"LINE 8:     COALESCE(row_to_json(item_info.*), '{}') AS item_info                                 ^',
                                         payload=None,
                                         sql='WITH sum_cte AS (  SELECT mi.id, SUM(mil.quantity_on_hand) AS total_sum  FROM main_item_locations mil  JOIN main_items mi ON mil.part_id = mi.id  GROUP BY mi.id)SELECT main_items.*,    COALESCE(row_to_json(item_info.*), '{}') AS item_infoFROM main_itemsLEFT JOIN main_item_info ON main_items.item_info_id = main_item_info.idLEFT JOIN units ON units.id = main_item_info.uomLEFT JOIN sum_cte ON main_items.id = sum_cte.idWHERE main_item_info.safety_stock > COALESCE(sum_cte.total_sum, 0);')
2025-08-14 18:26:50.593711 --- ERROR --- DatabaseError(message='column "type" of relation "main_shopping_lists" does not existLINE 2: (name, description, author, creation_date, type)                                                    ^',
                                         payload=('Planned Dinners', 'test', 1, datetime.datetime(2025, 8, 14, 18, 26, 50, 576115), 'plain'),
                                         sql='INSERT INTO main_shopping_lists(name, description, author, creation_date, type) VALUES (%s, %s, %s, %s, %s) RETURNING *;')
2025-08-14 19:29:53.965745 --- ERROR --- DatabaseError(message='syntax error at or near "gen_random_uuid"LINE 3:     food_info_uuid UUID gen_random_uuid(),                                ^',
                                         payload=CREATE TABLE IF NOT EXISTS teast_food_info (
    id SERIAL PRIMARY KEY,
    food_info_uuid UUID gen_random_uuid(),
    food_groups TEXT [],
    ingrediants TEXT [],
    nutrients JSONB,
    expires BOOLEAN,
    default_expiration FLOAT8,
    UNIQUE(food_info_uuid)
);,
                                         sql='food_info')
2025-08-14 19:34:05.734175 --- ERROR --- DatabaseError(message='syntax error at or near "gen_random_uuid"LINE 3:     item_info_uuid UUID gen_random_uuid(),                                ^',
                                         payload=CREATE TABLE IF NOt EXISTS teat_item_info (
    id SERIAL PRIMARY KEY,
    item_info_uuid UUID gen_random_uuid(),
    barcode VARCHAR(255),
    packaging VARCHAR(255),
    uom_quantity FLOAT8,
    uom INTEGER,
    cost FLOAT8,
    safety_stock FLOAT8,
    lead_time_days FLOAT8,
    ai_pick BOOLEAN,
    prefixes INTEGER []
    UNIQUE(item_info_uuid)
);,
                                         sql='item_info')
2025-08-14 19:34:50.879543 --- ERROR --- DatabaseError(message='syntax error at or near "("LINE 13:     UNIQUE(item_info_uuid)                   ^',
                                         payload=CREATE TABLE IF NOt EXISTS teat_item_info (
    id SERIAL PRIMARY KEY,
    item_info_uuid UUID DEFAULT gen_random_uuid() NOT NULL,
    barcode VARCHAR(255),
    packaging VARCHAR(255),
    uom_quantity FLOAT8,
    uom INTEGER,
    cost FLOAT8,
    safety_stock FLOAT8,
    lead_time_days FLOAT8,
    ai_pick BOOLEAN,
    prefixes INTEGER []
    UNIQUE(item_info_uuid)
);,
                                         sql='item_info')
2025-08-14 19:35:21.231158 --- ERROR --- DatabaseError(message='syntax error at or near "gen_random_uuid"LINE 3:     logistics_info_uuid UUID gen_random_uuid(),                                     ^',
                                         payload=CREATE TABLE IF NOT EXISTS tet_logistics_info(
    id SERIAL PRIMARY KEY,
    logistics_info_uuid UUID gen_random_uuid(),
    barcode VARCHAR(255),
    primary_location INTEGER NOT NULL,
    primary_zone INTEGER NOT NULL,
    auto_issue_location INTEGER NOT NULL,
    auto_issue_zone INTEGER NOT NULL,
    UNIQUE(logistics_info_uuid),
    CONSTRAINT fk_primary_location
        FOREIGN KEY(primary_location) 
        REFERENCES tet_locations(id),
    CONSTRAINT fk_primary_zone
        FOREIGN KEY(primary_zone) 
        REFERENCES tet_zones(id),
    CONSTRAINT fk_auto_issue_location
        FOREIGN KEY(auto_issue_location) 
        REFERENCES tet_locations(id),
    CONSTRAINT fk_auto_issue_zone
        FOREIGN KEY(auto_issue_zone) 
        REFERENCES tet_zones(id)
);,
                                         sql='logistics_info')
2025-08-14 19:37:59.688952 --- ERROR --- DatabaseError(message='null value in column "item_info_uuid" of relation "tet_items" violates not-null constraintDETAIL:  Failing row contains (1, 89f132f4-78b2-4d34-bdf0-ade0f15b7d35, null, test, 1, , {}, {"main": ""}, 1, null, 1, null, 1, null, single, FOOD, &&test&&).',
                                         payload=(None, 'test', 1, '', '{}', '{"main": ""}', 1, 1, 1, 'single', 'FOOD', '&&test&&'),
                                         sql='INSERT INTO tet_items(barcode, item_name, brand, description, tags, links, item_info_id, logistics_info_id, food_info_id, row_type, item_type, search_string) VALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s) RETURNING *;')
2025-08-14 19:48:30.781212 --- ERROR --- DatabaseError(message='null value in column "item_info_uuid" of relation "tet_items" violates not-null constraintDETAIL:  Failing row contains (1, 2ec1ebdf-0794-4e3a-9dfa-d284bfb703af, null, tet, 1, , {}, {"main": ""}, 1, null, 1, null, 1, null, single, FOOD, &&tet&&).',
                                         payload=(None, 'tet', 1, '', '{}', '{"main": ""}', 1, 1, 1, 'single', 'FOOD', '&&tet&&'),
                                         sql='INSERT INTO tet_items(barcode, item_name, brand, description, tags, links, item_info_id, logistics_info_id, food_info_id, row_type, item_type, search_string) VALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s) RETURNING *;')
2025-08-14 20:08:32.492285 --- ERROR --- DatabaseError(message='null value in column "item_info_uuid" of relation "tet_items" violates not-null constraintDETAIL:  Failing row contains (2, 62f23dd1-8af8-48a0-a95f-fb1582d1028f, null, tet, 1, , {}, {"main": ""}, 2, null, 2, null, 2, null, single, FOOD, &&tet&&).',
                                         payload=(None, 'tet', 1, '', '{}', '{"main": ""}', 2, 2, 2, 'single', 'FOOD', '&&tet&&'),
                                         sql='INSERT INTO tet_items(barcode, item_name, brand, description, tags, links, item_info_id, logistics_info_id, food_info_id, row_type, item_type, search_string) VALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s) RETURNING *;')
2025-08-14 20:08:55.912521 --- ERROR --- DatabaseError(message='null value in column "item_info_uuid" of relation "tet_items" violates not-null constraintDETAIL:  Failing row contains (3, f2c4fa98-7758-44af-b38c-dacc7e52e57a, null, rwar, 1, , {}, {"main": ""}, 3, null, 3, null, 3, null, single, FOOD, &&rwar&&).',
                                         payload=(None, 'rwar', 1, '', '{}', '{"main": ""}', 3, 3, 3, 'single', 'FOOD', '&&rwar&&'),
                                         sql='INSERT INTO tet_items(barcode, item_name, brand, description, tags, links, item_info_id, logistics_info_id, food_info_id, row_type, item_type, search_string) VALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s) RETURNING *;')
2025-08-14 20:09:48.986654 --- ERROR --- DatabaseError(message='tuple index out of range',
                                         payload=(None, 'rwar', 1, '', '{}', '{"main": ""}', 4, 4, 4, 'single', 'FOOD', '&&rwar&&'),
                                         sql='INSERT INTO tet_items(barcode, item_name, brand, description, tags, links, item_info_id, item_info_uuid, logistics_info_id, logistics_info_uuid, food_info_id, food_info_uuid, row_type, item_type, search_string) VALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s) RETURNING *;')
2025-08-14 20:19:34.321246 --- ERROR --- DatabaseError(message='column tet_shopping_list_items.sl_id does not existLINE 29: ...et_shopping_list_items ON tet_shopping_lists.id = tet_shoppi...                                                              ^',
                                         payload=('7152448a-39b7-4fcc-8b7b-5689f1ea598b',),
                                         sql='WITH passed_id AS (SELECT id AS passed_id FROM tet_items WHERE item_uuid=%s),    logistics_id AS (SELECT logistics_info_id FROM tet_items WHERE id=(SELECT passed_id FROM passed_id)),    info_id AS (SELECT item_info_id FROM tet_items WHERE id=(SELECT passed_id FROM passed_id)),    cte_item_info AS (        SELECT         tet_item_info.*,        row_to_json(units.*) as uom         FROM tet_item_info        LEFT JOIN units ON tet_item_info.uom = units.id        WHERE tet_item_info.id = (SELECT item_info_id FROM info_id)    ),    cte_groups AS (        SELECT             tet_groups.*,             tet_group_items.uuid,            tet_group_items.item_type,            tet_group_items.qty        FROM tet_groups        JOIN tet_group_items ON tet_groups.id = tet_group_items.gr_id        WHERE tet_group_items.item_id = (SELECT passed_id FROM passed_id)    ),    cte_shopping_lists AS (        SELECT             tet_shopping_lists.*,             tet_shopping_list_items.uuid,            tet_shopping_list_items.item_type,            tet_shopping_list_items.qty        FROM tet_shopping_lists        JOIN tet_shopping_list_items ON tet_shopping_lists.id = tet_shopping_list_items.sl_id        WHERE tet_shopping_list_items.item_id = (SELECT passed_id FROM passed_id)    ),    cte_itemlinks AS (        SELECT * FROM tet_itemlinks WHERE link=(SELECT passed_id FROM passed_id)    ),    cte_item_locations AS (        SELECT * FROM tet_item_locations        LEFT JOIN tet_locations ON tet_locations.id = tet_item_locations.location_id        WHERE part_id = (SELECT passed_id FROM passed_id)    ),    cte_logistics_info AS (        SELECT         li.*,         row_to_json(pl) AS primary_location,        row_to_json(ail) AS auto_issue_location,        row_to_json(pz) AS primary_zone,        row_to_json(aiz) AS auto_issue_zone        FROM tet_logistics_info AS li        LEFT JOIN tet_locations AS pl ON li.primary_location = pl.id        LEFT JOIN tet_locations AS ail ON li.auto_issue_location = ail.id        LEFT JOIN tet_zones AS pz ON li.primary_zone = pz.id        LEFT JOIN tet_zones AS aiz ON li.auto_issue_zone = aiz.id        WHERE li.id=(SELECT logistics_info_id FROM logistics_id)    )SELECT    (SELECT passed_id FROM passed_id) AS passed_id,    tet_items.*,    (SELECT COALESCE(row_to_json(logis), '{}') FROM cte_logistics_info logis) AS logistics_info,    row_to_json(tet_food_info.*) as food_info,     row_to_json(tet_brands.*) as brand,    (SELECT COALESCE(row_to_json(ii), '{}') FROM cte_item_info ii) AS item_info,    (SELECT COALESCE(array_agg(row_to_json(g)), '{}') FROM cte_groups g) AS item_groups,    (SELECT COALESCE(array_agg(row_to_json(sl)), '{}') FROM cte_shopping_lists sl) AS item_shopping_lists,    (SELECT COALESCE(array_agg(row_to_json(il)), '{}') FROM cte_itemlinks il) AS linked_items,    (SELECT COALESCE(array_agg(row_to_json(ils)), '{}') FROM cte_item_locations ils) AS item_locationsFROM tet_items    LEFT JOIN tet_item_info ON tet_items.item_info_id = tet_item_info.id     LEFT JOIN tet_food_info ON tet_items.food_info_id = tet_food_info.id     LEFT JOIN tet_brands ON tet_items.brand = tet_brands.id    LEFT JOIN units ON tet_item_info.uom = units.id     LEFT JOIN cte_groups ON tet_items.id = cte_groups.id    LEFT JOIN cte_shopping_lists ON tet_items.id = cte_shopping_lists.idWHERE tet_items.id=(SELECT passed_id FROM passed_id)GROUP BY     tet_items.id, tet_item_info.id, tet_food_info.id, tet_brands.id;')
2025-08-14 20:22:56.053977 --- ERROR --- DatabaseError(message='column tet_shopping_list_items.sl_id does not existLINE 19: ...et_shopping_list_items ON tet_shopping_lists.id = tet_shoppi...                                                              ^',
                                         payload=('7152448a-39b7-4fcc-8b7b-5689f1ea598b',),
                                         sql='WITH passed_id AS (SELECT id AS passed_id, item_uuid as passed_uuid FROM tet_items WHERE item_uuid=%s),    logistics_id AS (SELECT logistics_info_id FROM tet_items WHERE id=(SELECT passed_id FROM passed_id)),    info_id AS (SELECT item_info_id FROM tet_items WHERE id=(SELECT passed_id FROM passed_id)),    cte_item_info AS (        SELECT         tet_item_info.*,        row_to_json(units.*) as uom         FROM tet_item_info        LEFT JOIN units ON tet_item_info.uom = units.id        WHERE tet_item_info.id = (SELECT item_info_id FROM info_id)    ),    cte_shopping_lists AS (        SELECT             tet_shopping_lists.*,             tet_shopping_list_items.uuid,            tet_shopping_list_items.item_type,            tet_shopping_list_items.qty        FROM tet_shopping_lists        JOIN tet_shopping_list_items ON tet_shopping_lists.id = tet_shopping_list_items.sl_id        WHERE tet_shopping_list_items.item_uuid = (SELECT passed_uuid FROM passed_id)    ),    cte_itemlinks AS (        SELECT * FROM tet_itemlinks WHERE link=(SELECT passed_id FROM passed_id)    ),    cte_item_locations AS (        SELECT * FROM tet_item_locations        LEFT JOIN tet_locations ON tet_locations.id = tet_item_locations.location_id        WHERE part_id = (SELECT passed_id FROM passed_id)    ),    cte_logistics_info AS (        SELECT         li.*,         row_to_json(pl) AS primary_location,        row_to_json(ail) AS auto_issue_location,        row_to_json(pz) AS primary_zone,        row_to_json(aiz) AS auto_issue_zone        FROM tet_logistics_info AS li        LEFT JOIN tet_locations AS pl ON li.primary_location = pl.id        LEFT JOIN tet_locations AS ail ON li.auto_issue_location = ail.id        LEFT JOIN tet_zones AS pz ON li.primary_zone = pz.id        LEFT JOIN tet_zones AS aiz ON li.auto_issue_zone = aiz.id        WHERE li.id=(SELECT logistics_info_id FROM logistics_id)    )SELECT    (SELECT passed_id FROM passed_id) AS passed_id,    tet_items.*,    (SELECT COALESCE(row_to_json(logis), '{}') FROM cte_logistics_info logis) AS logistics_info,    row_to_json(tet_food_info.*) as food_info,     row_to_json(tet_brands.*) as brand,    (SELECT COALESCE(row_to_json(ii), '{}') FROM cte_item_info ii) AS item_info,    (SELECT COALESCE(array_agg(row_to_json(g)), '{}') FROM cte_groups g) AS item_groups,    (SELECT COALESCE(array_agg(row_to_json(sl)), '{}') FROM cte_shopping_lists sl) AS item_shopping_lists,    (SELECT COALESCE(array_agg(row_to_json(il)), '{}') FROM cte_itemlinks il) AS linked_items,    (SELECT COALESCE(array_agg(row_to_json(ils)), '{}') FROM cte_item_locations ils) AS item_locationsFROM tet_items    LEFT JOIN tet_item_info ON tet_items.item_info_id = tet_item_info.id     LEFT JOIN tet_food_info ON tet_items.food_info_id = tet_food_info.id     LEFT JOIN tet_brands ON tet_items.brand = tet_brands.id    LEFT JOIN units ON tet_item_info.uom = units.id     LEFT JOIN cte_groups ON tet_items.id = cte_groups.id    LEFT JOIN cte_shopping_lists ON tet_items.id = cte_shopping_lists.idWHERE tet_items.id=(SELECT passed_id FROM passed_id)GROUP BY     tet_items.id, tet_item_info.id, tet_food_info.id, tet_brands.id;')
2025-08-14 20:23:56.287364 --- ERROR --- DatabaseError(message='column tet_shopping_list_items.uuid does not existLINE 15:             tet_shopping_list_items.uuid,                     ^',
                                         payload=('7152448a-39b7-4fcc-8b7b-5689f1ea598b',),
                                         sql='WITH passed_id AS (SELECT id AS passed_id, item_uuid as passed_uuid FROM tet_items WHERE item_uuid=%s),    logistics_id AS (SELECT logistics_info_id FROM tet_items WHERE id=(SELECT passed_id FROM passed_id)),    info_id AS (SELECT item_info_id FROM tet_items WHERE id=(SELECT passed_id FROM passed_id)),    cte_item_info AS (        SELECT         tet_item_info.*,        row_to_json(units.*) as uom         FROM tet_item_info        LEFT JOIN units ON tet_item_info.uom = units.id        WHERE tet_item_info.id = (SELECT item_info_id FROM info_id)    ),    cte_shopping_lists AS (        SELECT             tet_shopping_lists.*,             tet_shopping_list_items.uuid,            tet_shopping_list_items.item_type,            tet_shopping_list_items.qty        FROM tet_shopping_lists        JOIN tet_shopping_list_items ON tet_shopping_lists.list_uuid = tet_shopping_list_items.list_uuid        WHERE tet_shopping_list_items.item_uuid = (SELECT passed_uuid FROM passed_id)    ),    cte_itemlinks AS (        SELECT * FROM tet_itemlinks WHERE link=(SELECT passed_id FROM passed_id)    ),    cte_item_locations AS (        SELECT * FROM tet_item_locations        LEFT JOIN tet_locations ON tet_locations.id = tet_item_locations.location_id        WHERE part_id = (SELECT passed_id FROM passed_id)    ),    cte_logistics_info AS (        SELECT         li.*,         row_to_json(pl) AS primary_location,        row_to_json(ail) AS auto_issue_location,        row_to_json(pz) AS primary_zone,        row_to_json(aiz) AS auto_issue_zone        FROM tet_logistics_info AS li        LEFT JOIN tet_locations AS pl ON li.primary_location = pl.id        LEFT JOIN tet_locations AS ail ON li.auto_issue_location = ail.id        LEFT JOIN tet_zones AS pz ON li.primary_zone = pz.id        LEFT JOIN tet_zones AS aiz ON li.auto_issue_zone = aiz.id        WHERE li.id=(SELECT logistics_info_id FROM logistics_id)    )SELECT    (SELECT passed_id FROM passed_id) AS passed_id,    tet_items.*,    (SELECT COALESCE(row_to_json(logis), '{}') FROM cte_logistics_info logis) AS logistics_info,    row_to_json(tet_food_info.*) as food_info,     row_to_json(tet_brands.*) as brand,    (SELECT COALESCE(row_to_json(ii), '{}') FROM cte_item_info ii) AS item_info,    (SELECT COALESCE(array_agg(row_to_json(g)), '{}') FROM cte_groups g) AS item_groups,    (SELECT COALESCE(array_agg(row_to_json(sl)), '{}') FROM cte_shopping_lists sl) AS item_shopping_lists,    (SELECT COALESCE(array_agg(row_to_json(il)), '{}') FROM cte_itemlinks il) AS linked_items,    (SELECT COALESCE(array_agg(row_to_json(ils)), '{}') FROM cte_item_locations ils) AS item_locationsFROM tet_items    LEFT JOIN tet_item_info ON tet_items.item_info_id = tet_item_info.id     LEFT JOIN tet_food_info ON tet_items.food_info_id = tet_food_info.id     LEFT JOIN tet_brands ON tet_items.brand = tet_brands.id    LEFT JOIN units ON tet_item_info.uom = units.id     LEFT JOIN cte_groups ON tet_items.id = cte_groups.id    LEFT JOIN cte_shopping_lists ON tet_items.id = cte_shopping_lists.idWHERE tet_items.id=(SELECT passed_id FROM passed_id)GROUP BY     tet_items.id, tet_item_info.id, tet_food_info.id, tet_brands.id;')
2025-08-14 20:24:28.412448 --- ERROR --- DatabaseError(message='relation "cte_groups" does not existLINE 60:     LEFT JOIN cte_groups ON tet_items.id = cte_groups.id                       ^',
                                         payload=('7152448a-39b7-4fcc-8b7b-5689f1ea598b',),
                                         sql='WITH passed_id AS (SELECT id AS passed_id, item_uuid as passed_uuid FROM tet_items WHERE item_uuid=%s),    logistics_id AS (SELECT logistics_info_id FROM tet_items WHERE id=(SELECT passed_id FROM passed_id)),    info_id AS (SELECT item_info_id FROM tet_items WHERE id=(SELECT passed_id FROM passed_id)),    cte_item_info AS (        SELECT         tet_item_info.*,        row_to_json(units.*) as uom         FROM tet_item_info        LEFT JOIN units ON tet_item_info.uom = units.id        WHERE tet_item_info.id = (SELECT item_info_id FROM info_id)    ),    cte_shopping_lists AS (        SELECT             tet_shopping_lists.*,             tet_shopping_list_items.item_type,            tet_shopping_list_items.qty        FROM tet_shopping_lists        JOIN tet_shopping_list_items ON tet_shopping_lists.list_uuid = tet_shopping_list_items.list_uuid        WHERE tet_shopping_list_items.item_uuid = (SELECT passed_uuid FROM passed_id)    ),    cte_itemlinks AS (        SELECT * FROM tet_itemlinks WHERE link=(SELECT passed_id FROM passed_id)    ),    cte_item_locations AS (        SELECT * FROM tet_item_locations        LEFT JOIN tet_locations ON tet_locations.id = tet_item_locations.location_id        WHERE part_id = (SELECT passed_id FROM passed_id)    ),    cte_logistics_info AS (        SELECT         li.*,         row_to_json(pl) AS primary_location,        row_to_json(ail) AS auto_issue_location,        row_to_json(pz) AS primary_zone,        row_to_json(aiz) AS auto_issue_zone        FROM tet_logistics_info AS li        LEFT JOIN tet_locations AS pl ON li.primary_location = pl.id        LEFT JOIN tet_locations AS ail ON li.auto_issue_location = ail.id        LEFT JOIN tet_zones AS pz ON li.primary_zone = pz.id        LEFT JOIN tet_zones AS aiz ON li.auto_issue_zone = aiz.id        WHERE li.id=(SELECT logistics_info_id FROM logistics_id)    )SELECT    (SELECT passed_id FROM passed_id) AS passed_id,    tet_items.*,    (SELECT COALESCE(row_to_json(logis), '{}') FROM cte_logistics_info logis) AS logistics_info,    row_to_json(tet_food_info.*) as food_info,     row_to_json(tet_brands.*) as brand,    (SELECT COALESCE(row_to_json(ii), '{}') FROM cte_item_info ii) AS item_info,    (SELECT COALESCE(array_agg(row_to_json(g)), '{}') FROM cte_groups g) AS item_groups,    (SELECT COALESCE(array_agg(row_to_json(sl)), '{}') FROM cte_shopping_lists sl) AS item_shopping_lists,    (SELECT COALESCE(array_agg(row_to_json(il)), '{}') FROM cte_itemlinks il) AS linked_items,    (SELECT COALESCE(array_agg(row_to_json(ils)), '{}') FROM cte_item_locations ils) AS item_locationsFROM tet_items    LEFT JOIN tet_item_info ON tet_items.item_info_id = tet_item_info.id     LEFT JOIN tet_food_info ON tet_items.food_info_id = tet_food_info.id     LEFT JOIN tet_brands ON tet_items.brand = tet_brands.id    LEFT JOIN units ON tet_item_info.uom = units.id     LEFT JOIN cte_groups ON tet_items.id = cte_groups.id    LEFT JOIN cte_shopping_lists ON tet_items.id = cte_shopping_lists.idWHERE tet_items.id=(SELECT passed_id FROM passed_id)GROUP BY     tet_items.id, tet_item_info.id, tet_food_info.id, tet_brands.id;')
2025-08-14 20:25:02.052879 --- ERROR --- DatabaseError(message='relation "cte_groups" does not existLINE 59:     LEFT JOIN cte_groups ON tet_items.id = cte_groups.id                       ^',
                                         payload=('7152448a-39b7-4fcc-8b7b-5689f1ea598b',),
                                         sql='WITH passed_id AS (SELECT id AS passed_id, item_uuid as passed_uuid FROM tet_items WHERE item_uuid=%s),    logistics_id AS (SELECT logistics_info_id FROM tet_items WHERE id=(SELECT passed_id FROM passed_id)),    info_id AS (SELECT item_info_id FROM tet_items WHERE id=(SELECT passed_id FROM passed_id)),    cte_item_info AS (        SELECT         tet_item_info.*,        row_to_json(units.*) as uom         FROM tet_item_info        LEFT JOIN units ON tet_item_info.uom = units.id        WHERE tet_item_info.id = (SELECT item_info_id FROM info_id)    ),    cte_shopping_lists AS (        SELECT             tet_shopping_lists.*,             tet_shopping_list_items.item_type,            tet_shopping_list_items.qty        FROM tet_shopping_lists        JOIN tet_shopping_list_items ON tet_shopping_lists.list_uuid = tet_shopping_list_items.list_uuid        WHERE tet_shopping_list_items.item_uuid = (SELECT passed_uuid FROM passed_id)    ),    cte_itemlinks AS (        SELECT * FROM tet_itemlinks WHERE link=(SELECT passed_id FROM passed_id)    ),    cte_item_locations AS (        SELECT * FROM tet_item_locations        LEFT JOIN tet_locations ON tet_locations.id = tet_item_locations.location_id        WHERE part_id = (SELECT passed_id FROM passed_id)    ),    cte_logistics_info AS (        SELECT         li.*,         row_to_json(pl) AS primary_location,        row_to_json(ail) AS auto_issue_location,        row_to_json(pz) AS primary_zone,        row_to_json(aiz) AS auto_issue_zone        FROM tet_logistics_info AS li        LEFT JOIN tet_locations AS pl ON li.primary_location = pl.id        LEFT JOIN tet_locations AS ail ON li.auto_issue_location = ail.id        LEFT JOIN tet_zones AS pz ON li.primary_zone = pz.id        LEFT JOIN tet_zones AS aiz ON li.auto_issue_zone = aiz.id        WHERE li.id=(SELECT logistics_info_id FROM logistics_id)    )SELECT    (SELECT passed_id FROM passed_id) AS passed_id,    tet_items.*,    (SELECT COALESCE(row_to_json(logis), '{}') FROM cte_logistics_info logis) AS logistics_info,    row_to_json(tet_food_info.*) as food_info,     row_to_json(tet_brands.*) as brand,    (SELECT COALESCE(row_to_json(ii), '{}') FROM cte_item_info ii) AS item_info,    (SELECT COALESCE(array_agg(row_to_json(sl)), '{}') FROM cte_shopping_lists sl) AS item_shopping_lists,    (SELECT COALESCE(array_agg(row_to_json(il)), '{}') FROM cte_itemlinks il) AS linked_items,    (SELECT COALESCE(array_agg(row_to_json(ils)), '{}') FROM cte_item_locations ils) AS item_locationsFROM tet_items    LEFT JOIN tet_item_info ON tet_items.item_info_id = tet_item_info.id     LEFT JOIN tet_food_info ON tet_items.food_info_id = tet_food_info.id     LEFT JOIN tet_brands ON tet_items.brand = tet_brands.id    LEFT JOIN units ON tet_item_info.uom = units.id     LEFT JOIN cte_groups ON tet_items.id = cte_groups.id    LEFT JOIN cte_shopping_lists ON tet_items.id = cte_shopping_lists.idWHERE tet_items.id=(SELECT passed_id FROM passed_id)GROUP BY     tet_items.id, tet_item_info.id, tet_food_info.id, tet_brands.id;')
2025-08-14 20:25:41.026376 --- ERROR --- DatabaseError(message='column tet_shopping_list_items.sl_id does not existLINE 40: ...et_shopping_list_items ON tet_shopping_lists.id = tet_shoppi...                                                              ^',
                                         payload=(4,),
                                         sql='WITH passed_id AS (SELECT %s AS passed_id),    logistics_id AS (SELECT logistics_info_id FROM tet_items WHERE id=(SELECT passed_id FROM passed_id)),    info_id AS (SELECT item_info_id FROM tet_items WHERE id=(SELECT passed_id FROM passed_id)),    cte_conversions AS (        SELECT             tet_conversions.id as conv_id,            tet_conversions.conv_factor as conv_factor,            units.* as uom        FROM tet_conversions        LEFT JOIN units ON tet_conversions.uom_id = units.id        WHERE tet_conversions.item_id = (SELECT passed_id FROM passed_id)    ),    cte_item_info AS (        SELECT         tet_item_info.*,        row_to_json(units.*) as uom,        COALESCE((SELECT json_agg(convs) FROM cte_conversions convs), '[]'::json) AS conversions,        COALESCE((SELECT json_agg(p.*) FROM tet_sku_prefix as p WHERE p.id = ANY(tet_item_info.prefixes)), '[]'::json) as prefixes         FROM tet_item_info        LEFT JOIN units ON tet_item_info.uom = units.id        WHERE tet_item_info.id = (SELECT item_info_id FROM info_id)    ),    cte_groups AS (        SELECT             tet_groups.*,             tet_group_items.uuid,            tet_group_items.item_type,            tet_group_items.qty        FROM tet_groups        JOIN tet_group_items ON tet_groups.id = tet_group_items.gr_id        WHERE tet_group_items.item_id = (SELECT passed_id FROM passed_id)    ),    cte_shopping_lists AS (        SELECT             tet_shopping_lists.*,             tet_shopping_list_items.uuid,            tet_shopping_list_items.item_type,            tet_shopping_list_items.qty        FROM tet_shopping_lists        JOIN tet_shopping_list_items ON tet_shopping_lists.id = tet_shopping_list_items.sl_id        WHERE tet_shopping_list_items.item_id = (SELECT passed_id FROM passed_id)    ),    cte_itemlinks AS (        SELECT * FROM tet_itemlinks WHERE link=(SELECT passed_id FROM passed_id)    ),    cte_item_locations AS (        SELECT * FROM tet_item_locations        LEFT JOIN tet_locations ON tet_locations.id = tet_item_locations.location_id        WHERE part_id = (SELECT passed_id FROM passed_id)    ),    cte_logistics_info AS (        SELECT         li.*,         row_to_json(pl) AS primary_location,        row_to_json(ail) AS auto_issue_location,        row_to_json(pz) AS primary_zone,        row_to_json(aiz) AS auto_issue_zone        FROM tet_logistics_info AS li        LEFT JOIN tet_locations AS pl ON li.primary_location = pl.id        LEFT JOIN tet_locations AS ail ON li.auto_issue_location = ail.id        LEFT JOIN tet_zones AS pz ON li.primary_zone = pz.id        LEFT JOIN tet_zones AS aiz ON li.auto_issue_zone = aiz.id        WHERE li.id=(SELECT logistics_info_id FROM logistics_id)    ),    cte_barcodes AS (        SELECT         barcode.barcode As barcode,        barcode.in_exchange AS in_exchange,        barcode.out_exchange AS out_exchange,        barcode.descriptor AS descriptor        FROM tet_barcodes AS barcode        LEFT JOIN tet_items AS item ON item.id = (SELECT passed_id FROM passed_id)        WHERE barcode.item_uuid = item.item_uuid    )SELECT    (SELECT passed_id FROM passed_id) AS passed_id,    tet_items.*,    (SELECT COALESCE(row_to_json(logis), '{}') FROM cte_logistics_info logis) AS logistics_info,    row_to_json(tet_food_info.*) as food_info,     row_to_json(tet_brands.*) as brand,    (SELECT COALESCE(row_to_json(ii), '{}') FROM cte_item_info ii) AS item_info,    (SELECT COALESCE(array_agg(row_to_json(g)), '{}') FROM cte_groups g) AS item_groups,    (SELECT COALESCE(array_agg(row_to_json(sl)), '{}') FROM cte_shopping_lists sl) AS item_shopping_lists,    (SELECT COALESCE(array_agg(row_to_json(il)), '{}') FROM cte_itemlinks il) AS linked_items,    (SELECT COALESCE(array_agg(row_to_json(ils)), '{}') FROM cte_item_locations ils) AS item_locations,    (SELECT COALESCE(array_agg(row_to_json(bar)), '{}') FROM cte_barcodes bar) AS item_barcodesFROM tet_items    LEFT JOIN tet_item_info ON tet_items.item_info_id = tet_item_info.id     LEFT JOIN tet_food_info ON tet_items.food_info_id = tet_food_info.id     LEFT JOIN tet_brands ON tet_items.brand = tet_brands.id    LEFT JOIN units ON tet_item_info.uom = units.id     LEFT JOIN cte_groups ON tet_items.id = cte_groups.id    LEFT JOIN cte_shopping_lists ON tet_items.id = cte_shopping_lists.idWHERE tet_items.id=(SELECT passed_id FROM passed_id)GROUP BY     tet_items.id, tet_item_info.id, tet_food_info.id, tet_brands.id;')
2025-08-14 20:26:28.764969 --- ERROR --- DatabaseError(message='column tet_shopping_list_items.sl_id does not existLINE 40: ...et_shopping_list_items ON tet_shopping_lists.id = tet_shoppi...                                                              ^',
                                         payload=(4,),
                                         sql='WITH passed_id AS (SELECT %s AS passed_id),    logistics_id AS (SELECT logistics_info_id FROM tet_items WHERE id=(SELECT passed_id FROM passed_id)),    info_id AS (SELECT item_info_id FROM tet_items WHERE id=(SELECT passed_id FROM passed_id)),    cte_conversions AS (        SELECT             tet_conversions.id as conv_id,            tet_conversions.conv_factor as conv_factor,            units.* as uom        FROM tet_conversions        LEFT JOIN units ON tet_conversions.uom_id = units.id        WHERE tet_conversions.item_id = (SELECT passed_id FROM passed_id)    ),    cte_item_info AS (        SELECT         tet_item_info.*,        row_to_json(units.*) as uom,        COALESCE((SELECT json_agg(convs) FROM cte_conversions convs), '[]'::json) AS conversions,        COALESCE((SELECT json_agg(p.*) FROM tet_sku_prefix as p WHERE p.id = ANY(tet_item_info.prefixes)), '[]'::json) as prefixes         FROM tet_item_info        LEFT JOIN units ON tet_item_info.uom = units.id        WHERE tet_item_info.id = (SELECT item_info_id FROM info_id)    ),    cte_groups AS (        SELECT             tet_groups.*,             tet_group_items.uuid,            tet_group_items.item_type,            tet_group_items.qty        FROM tet_groups        JOIN tet_group_items ON tet_groups.id = tet_group_items.gr_id        WHERE tet_group_items.item_id = (SELECT passed_id FROM passed_id)    ),    cte_shopping_lists AS (        SELECT             tet_shopping_lists.*,             tet_shopping_list_items.uuid,            tet_shopping_list_items.item_type,            tet_shopping_list_items.qty        FROM tet_shopping_lists        JOIN tet_shopping_list_items ON tet_shopping_lists.id = tet_shopping_list_items.sl_id        WHERE tet_shopping_list_items.item_id = (SELECT passed_id FROM passed_id)    ),    cte_itemlinks AS (        SELECT * FROM tet_itemlinks WHERE link=(SELECT passed_id FROM passed_id)    ),    cte_item_locations AS (        SELECT * FROM tet_item_locations        LEFT JOIN tet_locations ON tet_locations.id = tet_item_locations.location_id        WHERE part_id = (SELECT passed_id FROM passed_id)    ),    cte_logistics_info AS (        SELECT         li.*,         row_to_json(pl) AS primary_location,        row_to_json(ail) AS auto_issue_location,        row_to_json(pz) AS primary_zone,        row_to_json(aiz) AS auto_issue_zone        FROM tet_logistics_info AS li        LEFT JOIN tet_locations AS pl ON li.primary_location = pl.id        LEFT JOIN tet_locations AS ail ON li.auto_issue_location = ail.id        LEFT JOIN tet_zones AS pz ON li.primary_zone = pz.id        LEFT JOIN tet_zones AS aiz ON li.auto_issue_zone = aiz.id        WHERE li.id=(SELECT logistics_info_id FROM logistics_id)    ),    cte_barcodes AS (        SELECT         barcode.barcode As barcode,        barcode.in_exchange AS in_exchange,        barcode.out_exchange AS out_exchange,        barcode.descriptor AS descriptor        FROM tet_barcodes AS barcode        LEFT JOIN tet_items AS item ON item.id = (SELECT passed_id FROM passed_id)        WHERE barcode.item_uuid = item.item_uuid    )SELECT    (SELECT passed_id FROM passed_id) AS passed_id,    tet_items.*,    (SELECT COALESCE(row_to_json(logis), '{}') FROM cte_logistics_info logis) AS logistics_info,    row_to_json(tet_food_info.*) as food_info,     row_to_json(tet_brands.*) as brand,    (SELECT COALESCE(row_to_json(ii), '{}') FROM cte_item_info ii) AS item_info,    (SELECT COALESCE(array_agg(row_to_json(g)), '{}') FROM cte_groups g) AS item_groups,    (SELECT COALESCE(array_agg(row_to_json(sl)), '{}') FROM cte_shopping_lists sl) AS item_shopping_lists,    (SELECT COALESCE(array_agg(row_to_json(il)), '{}') FROM cte_itemlinks il) AS linked_items,    (SELECT COALESCE(array_agg(row_to_json(ils)), '{}') FROM cte_item_locations ils) AS item_locations,    (SELECT COALESCE(array_agg(row_to_json(bar)), '{}') FROM cte_barcodes bar) AS item_barcodesFROM tet_items    LEFT JOIN tet_item_info ON tet_items.item_info_id = tet_item_info.id     LEFT JOIN tet_food_info ON tet_items.food_info_id = tet_food_info.id     LEFT JOIN tet_brands ON tet_items.brand = tet_brands.id    LEFT JOIN units ON tet_item_info.uom = units.id     LEFT JOIN cte_groups ON tet_items.id = cte_groups.id    LEFT JOIN cte_shopping_lists ON tet_items.id = cte_shopping_lists.idWHERE tet_items.id=(SELECT passed_id FROM passed_id)GROUP BY     tet_items.id, tet_item_info.id, tet_food_info.id, tet_brands.id;')
2025-08-14 20:30:56.312900 --- ERROR --- DatabaseError(message='column tet_shopping_list_items.sl_id does not existLINE 40: ...et_shopping_list_items ON tet_shopping_lists.id = tet_shoppi...                                                              ^',
                                         payload=(4,),
                                         sql='WITH passed_id AS (SELECT %s AS passed_id),    logistics_id AS (SELECT logistics_info_id FROM tet_items WHERE id=(SELECT passed_id FROM passed_id)),    info_id AS (SELECT item_info_id FROM tet_items WHERE id=(SELECT passed_id FROM passed_id)),    cte_conversions AS (        SELECT             tet_conversions.id as conv_id,            tet_conversions.conv_factor as conv_factor,            units.* as uom        FROM tet_conversions        LEFT JOIN units ON tet_conversions.uom_id = units.id        WHERE tet_conversions.item_id = (SELECT passed_id FROM passed_id)    ),    cte_item_info AS (        SELECT         tet_item_info.*,        row_to_json(units.*) as uom,        COALESCE((SELECT json_agg(convs) FROM cte_conversions convs), '[]'::json) AS conversions,        COALESCE((SELECT json_agg(p.*) FROM tet_sku_prefix as p WHERE p.id = ANY(tet_item_info.prefixes)), '[]'::json) as prefixes         FROM tet_item_info        LEFT JOIN units ON tet_item_info.uom = units.id        WHERE tet_item_info.id = (SELECT item_info_id FROM info_id)    ),    cte_groups AS (        SELECT             tet_groups.*,             tet_group_items.uuid,            tet_group_items.item_type,            tet_group_items.qty        FROM tet_groups        JOIN tet_group_items ON tet_groups.id = tet_group_items.gr_id        WHERE tet_group_items.item_id = (SELECT passed_id FROM passed_id)    ),    cte_shopping_lists AS (        SELECT             tet_shopping_lists.*,             tet_shopping_list_items.uuid,            tet_shopping_list_items.item_type,            tet_shopping_list_items.qty        FROM tet_shopping_lists        JOIN tet_shopping_list_items ON tet_shopping_lists.id = tet_shopping_list_items.sl_id        WHERE tet_shopping_list_items.item_id = (SELECT passed_id FROM passed_id)    ),    cte_itemlinks AS (        SELECT * FROM tet_itemlinks WHERE link=(SELECT passed_id FROM passed_id)    ),    cte_item_locations AS (        SELECT * FROM tet_item_locations        LEFT JOIN tet_locations ON tet_locations.id = tet_item_locations.location_id        WHERE part_id = (SELECT passed_id FROM passed_id)    ),    cte_logistics_info AS (        SELECT         li.*,         row_to_json(pl) AS primary_location,        row_to_json(ail) AS auto_issue_location,        row_to_json(pz) AS primary_zone,        row_to_json(aiz) AS auto_issue_zone        FROM tet_logistics_info AS li        LEFT JOIN tet_locations AS pl ON li.primary_location = pl.id        LEFT JOIN tet_locations AS ail ON li.auto_issue_location = ail.id        LEFT JOIN tet_zones AS pz ON li.primary_zone = pz.id        LEFT JOIN tet_zones AS aiz ON li.auto_issue_zone = aiz.id        WHERE li.id=(SELECT logistics_info_id FROM logistics_id)    ),    cte_barcodes AS (        SELECT         barcode.barcode As barcode,        barcode.in_exchange AS in_exchange,        barcode.out_exchange AS out_exchange,        barcode.descriptor AS descriptor        FROM tet_barcodes AS barcode        LEFT JOIN tet_items AS item ON item.id = (SELECT passed_id FROM passed_id)        WHERE barcode.item_uuid = item.item_uuid    )SELECT    (SELECT passed_id FROM passed_id) AS passed_id,    tet_items.*,    (SELECT COALESCE(row_to_json(logis), '{}') FROM cte_logistics_info logis) AS logistics_info,    row_to_json(tet_food_info.*) as food_info,     row_to_json(tet_brands.*) as brand,    (SELECT COALESCE(row_to_json(ii), '{}') FROM cte_item_info ii) AS item_info,    (SELECT COALESCE(array_agg(row_to_json(g)), '{}') FROM cte_groups g) AS item_groups,    (SELECT COALESCE(array_agg(row_to_json(sl)), '{}') FROM cte_shopping_lists sl) AS item_shopping_lists,    (SELECT COALESCE(array_agg(row_to_json(il)), '{}') FROM cte_itemlinks il) AS linked_items,    (SELECT COALESCE(array_agg(row_to_json(ils)), '{}') FROM cte_item_locations ils) AS item_locations,    (SELECT COALESCE(array_agg(row_to_json(bar)), '{}') FROM cte_barcodes bar) AS item_barcodesFROM tet_items    LEFT JOIN tet_item_info ON tet_items.item_info_id = tet_item_info.id     LEFT JOIN tet_food_info ON tet_items.food_info_id = tet_food_info.id     LEFT JOIN tet_brands ON tet_items.brand = tet_brands.id    LEFT JOIN units ON tet_item_info.uom = units.id     LEFT JOIN cte_groups ON tet_items.id = cte_groups.id    LEFT JOIN cte_shopping_lists ON tet_items.id = cte_shopping_lists.idWHERE tet_items.id=(SELECT passed_id FROM passed_id)GROUP BY     tet_items.id, tet_item_info.id, tet_food_info.id, tet_brands.id;')
2025-08-14 20:31:47.355307 --- ERROR --- DatabaseError(message='column tet_shopping_list_items.sl_id does not existLINE 30: ...et_shopping_list_items ON tet_shopping_lists.id = tet_shoppi...                                                              ^',
                                         payload=(4,),
                                         sql='WITH passed_id AS (SELECT %s AS passed_id),    logistics_id AS (SELECT logistics_info_id FROM tet_items WHERE id=(SELECT passed_id FROM passed_id)),    info_id AS (SELECT item_info_id FROM tet_items WHERE id=(SELECT passed_id FROM passed_id)),    cte_conversions AS (        SELECT             tet_conversions.id as conv_id,            tet_conversions.conv_factor as conv_factor,            units.* as uom        FROM tet_conversions        LEFT JOIN units ON tet_conversions.uom_id = units.id        WHERE tet_conversions.item_id = (SELECT passed_id FROM passed_id)    ),    cte_item_info AS (        SELECT         tet_item_info.*,        row_to_json(units.*) as uom,        COALESCE((SELECT json_agg(convs) FROM cte_conversions convs), '[]'::json) AS conversions,        COALESCE((SELECT json_agg(p.*) FROM tet_sku_prefix as p WHERE p.id = ANY(tet_item_info.prefixes)), '[]'::json) as prefixes         FROM tet_item_info        LEFT JOIN units ON tet_item_info.uom = units.id        WHERE tet_item_info.id = (SELECT item_info_id FROM info_id)    ),    cte_shopping_lists AS (        SELECT             tet_shopping_lists.*,             tet_shopping_list_items.uuid,            tet_shopping_list_items.item_type,            tet_shopping_list_items.qty        FROM tet_shopping_lists        JOIN tet_shopping_list_items ON tet_shopping_lists.id = tet_shopping_list_items.sl_id        WHERE tet_shopping_list_items.item_id = (SELECT passed_id FROM passed_id)    ),    cte_itemlinks AS (        SELECT * FROM tet_itemlinks WHERE link=(SELECT passed_id FROM passed_id)    ),    cte_item_locations AS (        SELECT * FROM tet_item_locations        LEFT JOIN tet_locations ON tet_locations.id = tet_item_locations.location_id        WHERE part_id = (SELECT passed_id FROM passed_id)    ),    cte_logistics_info AS (        SELECT         li.*,         row_to_json(pl) AS primary_location,        row_to_json(ail) AS auto_issue_location,        row_to_json(pz) AS primary_zone,        row_to_json(aiz) AS auto_issue_zone        FROM tet_logistics_info AS li        LEFT JOIN tet_locations AS pl ON li.primary_location = pl.id        LEFT JOIN tet_locations AS ail ON li.auto_issue_location = ail.id        LEFT JOIN tet_zones AS pz ON li.primary_zone = pz.id        LEFT JOIN tet_zones AS aiz ON li.auto_issue_zone = aiz.id        WHERE li.id=(SELECT logistics_info_id FROM logistics_id)    ),    cte_barcodes AS (        SELECT         barcode.barcode As barcode,        barcode.in_exchange AS in_exchange,        barcode.out_exchange AS out_exchange,        barcode.descriptor AS descriptor        FROM tet_barcodes AS barcode        LEFT JOIN tet_items AS item ON item.id = (SELECT passed_id FROM passed_id)        WHERE barcode.item_uuid = item.item_uuid    )SELECT    (SELECT passed_id FROM passed_id) AS passed_id,    tet_items.*,    (SELECT COALESCE(row_to_json(logis), '{}') FROM cte_logistics_info logis) AS logistics_info,    row_to_json(tet_food_info.*) as food_info,     row_to_json(tet_brands.*) as brand,    (SELECT COALESCE(row_to_json(ii), '{}') FROM cte_item_info ii) AS item_info,    (SELECT COALESCE(array_agg(row_to_json(sl)), '{}') FROM cte_shopping_lists sl) AS item_shopping_lists,    (SELECT COALESCE(array_agg(row_to_json(il)), '{}') FROM cte_itemlinks il) AS linked_items,    (SELECT COALESCE(array_agg(row_to_json(ils)), '{}') FROM cte_item_locations ils) AS item_locations,    (SELECT COALESCE(array_agg(row_to_json(bar)), '{}') FROM cte_barcodes bar) AS item_barcodesFROM tet_items    LEFT JOIN tet_item_info ON tet_items.item_info_id = tet_item_info.id     LEFT JOIN tet_food_info ON tet_items.food_info_id = tet_food_info.id     LEFT JOIN tet_brands ON tet_items.brand = tet_brands.id    LEFT JOIN units ON tet_item_info.uom = units.id     LEFT JOIN cte_shopping_lists ON tet_items.id = cte_shopping_lists.idWHERE tet_items.id=(SELECT passed_id FROM passed_id)GROUP BY     tet_items.id, tet_item_info.id, tet_food_info.id, tet_brands.id;')
2025-08-14 20:34:42.067464 --- ERROR --- DatabaseError(message='column tet_shopping_list_items.item_id does not existLINE 30:         WHERE tet_shopping_list_items.item_id = (SELECT pass...                       ^HINT:  Perhaps you meant to reference the column "tet_shopping_list_items.item_uuid".',
                                         payload=(4,),
                                         sql='WITH passed_id AS (SELECT %s AS passed_id),    logistics_id AS (SELECT logistics_info_id FROM tet_items WHERE id=(SELECT passed_id FROM passed_id)),    info_id AS (SELECT item_info_id FROM tet_items WHERE id=(SELECT passed_id FROM passed_id)),    cte_conversions AS (        SELECT             tet_conversions.id as conv_id,            tet_conversions.conv_factor as conv_factor,            units.* as uom        FROM tet_conversions        LEFT JOIN units ON tet_conversions.uom_id = units.id        WHERE tet_conversions.item_id = (SELECT passed_id FROM passed_id)    ),    cte_item_info AS (        SELECT         tet_item_info.*,        row_to_json(units.*) as uom,        COALESCE((SELECT json_agg(convs) FROM cte_conversions convs), '[]'::json) AS conversions,        COALESCE((SELECT json_agg(p.*) FROM tet_sku_prefix as p WHERE p.id = ANY(tet_item_info.prefixes)), '[]'::json) as prefixes         FROM tet_item_info        LEFT JOIN units ON tet_item_info.uom = units.id        WHERE tet_item_info.id = (SELECT item_info_id FROM info_id)    ),    cte_shopping_lists AS (        SELECT             tet_shopping_lists.*,             tet_shopping_list_items.item_type,            tet_shopping_list_items.qty        FROM tet_shopping_lists        JOIN tet_shopping_list_items ON tet_shopping_lists.list_uuid = tet_shopping_list_items.list_uuid        WHERE tet_shopping_list_items.item_id = (SELECT passed_id FROM passed_id)    ),    cte_itemlinks AS (        SELECT * FROM tet_itemlinks WHERE link=(SELECT passed_id FROM passed_id)    ),    cte_item_locations AS (        SELECT * FROM tet_item_locations        LEFT JOIN tet_locations ON tet_locations.id = tet_item_locations.location_id        WHERE part_id = (SELECT passed_id FROM passed_id)    ),    cte_logistics_info AS (        SELECT         li.*,         row_to_json(pl) AS primary_location,        row_to_json(ail) AS auto_issue_location,        row_to_json(pz) AS primary_zone,        row_to_json(aiz) AS auto_issue_zone        FROM tet_logistics_info AS li        LEFT JOIN tet_locations AS pl ON li.primary_location = pl.id        LEFT JOIN tet_locations AS ail ON li.auto_issue_location = ail.id        LEFT JOIN tet_zones AS pz ON li.primary_zone = pz.id        LEFT JOIN tet_zones AS aiz ON li.auto_issue_zone = aiz.id        WHERE li.id=(SELECT logistics_info_id FROM logistics_id)    ),    cte_barcodes AS (        SELECT         barcode.barcode As barcode,        barcode.in_exchange AS in_exchange,        barcode.out_exchange AS out_exchange,        barcode.descriptor AS descriptor        FROM tet_barcodes AS barcode        LEFT JOIN tet_items AS item ON item.id = (SELECT passed_id FROM passed_id)        WHERE barcode.item_uuid = item.item_uuid    )SELECT    (SELECT passed_id FROM passed_id) AS passed_id,    tet_items.*,    (SELECT COALESCE(row_to_json(logis), '{}') FROM cte_logistics_info logis) AS logistics_info,    row_to_json(tet_food_info.*) as food_info,     row_to_json(tet_brands.*) as brand,    (SELECT COALESCE(row_to_json(ii), '{}') FROM cte_item_info ii) AS item_info,    (SELECT COALESCE(array_agg(row_to_json(sl)), '{}') FROM cte_shopping_lists sl) AS item_shopping_lists,    (SELECT COALESCE(array_agg(row_to_json(il)), '{}') FROM cte_itemlinks il) AS linked_items,    (SELECT COALESCE(array_agg(row_to_json(ils)), '{}') FROM cte_item_locations ils) AS item_locations,    (SELECT COALESCE(array_agg(row_to_json(bar)), '{}') FROM cte_barcodes bar) AS item_barcodesFROM tet_items    LEFT JOIN tet_item_info ON tet_items.item_info_id = tet_item_info.id     LEFT JOIN tet_food_info ON tet_items.food_info_id = tet_food_info.id     LEFT JOIN tet_brands ON tet_items.brand = tet_brands.id    LEFT JOIN units ON tet_item_info.uom = units.id     LEFT JOIN cte_shopping_lists ON tet_items.id = cte_shopping_lists.idWHERE tet_items.id=(SELECT passed_id FROM passed_id)GROUP BY     tet_items.id, tet_item_info.id, tet_food_info.id, tet_brands.id;')
2025-08-14 20:35:41.885979 --- ERROR --- DatabaseError(message='column tet_shopping_list_items.item_id does not existLINE 30:         WHERE tet_shopping_list_items.item_id = (SELECT pass...                       ^HINT:  Perhaps you meant to reference the column "tet_shopping_list_items.item_uuid".',
                                         payload=(4,),
                                         sql='WITH passed_id AS (SELECT %s AS passed_id),    logistics_id AS (SELECT logistics_info_id FROM tet_items WHERE id=(SELECT passed_id FROM passed_id)),    info_id AS (SELECT item_info_id FROM tet_items WHERE id=(SELECT passed_id FROM passed_id)),    cte_conversions AS (        SELECT             tet_conversions.id as conv_id,            tet_conversions.conv_factor as conv_factor,            units.* as uom        FROM tet_conversions        LEFT JOIN units ON tet_conversions.uom_id = units.id        WHERE tet_conversions.item_id = (SELECT passed_id FROM passed_id)    ),    cte_item_info AS (        SELECT         tet_item_info.*,        row_to_json(units.*) as uom,        COALESCE((SELECT json_agg(convs) FROM cte_conversions convs), '[]'::json) AS conversions,        COALESCE((SELECT json_agg(p.*) FROM tet_sku_prefix as p WHERE p.id = ANY(tet_item_info.prefixes)), '[]'::json) as prefixes         FROM tet_item_info        LEFT JOIN units ON tet_item_info.uom = units.id        WHERE tet_item_info.id = (SELECT item_info_id FROM info_id)    ),    cte_shopping_lists AS (        SELECT             tet_shopping_lists.*,             tet_shopping_list_items.item_type,            tet_shopping_list_items.qty        FROM tet_shopping_lists        JOIN tet_shopping_list_items ON tet_shopping_lists.list_uuid = tet_shopping_list_items.list_uuid        WHERE tet_shopping_list_items.item_id = (SELECT passed_id FROM passed_id)    ),    cte_itemlinks AS (        SELECT * FROM tet_itemlinks WHERE link=(SELECT passed_id FROM passed_id)    ),    cte_item_locations AS (        SELECT * FROM tet_item_locations        LEFT JOIN tet_locations ON tet_locations.id = tet_item_locations.location_id        WHERE part_id = (SELECT passed_id FROM passed_id)    ),    cte_logistics_info AS (        SELECT         li.*,         row_to_json(pl) AS primary_location,        row_to_json(ail) AS auto_issue_location,        row_to_json(pz) AS primary_zone,        row_to_json(aiz) AS auto_issue_zone        FROM tet_logistics_info AS li        LEFT JOIN tet_locations AS pl ON li.primary_location = pl.id        LEFT JOIN tet_locations AS ail ON li.auto_issue_location = ail.id        LEFT JOIN tet_zones AS pz ON li.primary_zone = pz.id        LEFT JOIN tet_zones AS aiz ON li.auto_issue_zone = aiz.id        WHERE li.id=(SELECT logistics_info_id FROM logistics_id)    ),    cte_barcodes AS (        SELECT         barcode.barcode As barcode,        barcode.in_exchange AS in_exchange,        barcode.out_exchange AS out_exchange,        barcode.descriptor AS descriptor        FROM tet_barcodes AS barcode        LEFT JOIN tet_items AS item ON item.id = (SELECT passed_id FROM passed_id)        WHERE barcode.item_uuid = item.item_uuid    )SELECT    (SELECT passed_id FROM passed_id) AS passed_id,    tet_items.*,    (SELECT COALESCE(row_to_json(logis), '{}') FROM cte_logistics_info logis) AS logistics_info,    row_to_json(tet_food_info.*) as food_info,     row_to_json(tet_brands.*) as brand,    (SELECT COALESCE(row_to_json(ii), '{}') FROM cte_item_info ii) AS item_info,    (SELECT COALESCE(array_agg(row_to_json(sl)), '{}') FROM cte_shopping_lists sl) AS item_shopping_lists,    (SELECT COALESCE(array_agg(row_to_json(il)), '{}') FROM cte_itemlinks il) AS linked_items,    (SELECT COALESCE(array_agg(row_to_json(ils)), '{}') FROM cte_item_locations ils) AS item_locations,    (SELECT COALESCE(array_agg(row_to_json(bar)), '{}') FROM cte_barcodes bar) AS item_barcodesFROM tet_items    LEFT JOIN tet_item_info ON tet_items.item_info_id = tet_item_info.id     LEFT JOIN tet_food_info ON tet_items.food_info_id = tet_food_info.id     LEFT JOIN tet_brands ON tet_items.brand = tet_brands.id    LEFT JOIN units ON tet_item_info.uom = units.id     LEFT JOIN cte_shopping_lists ON tet_items.id = cte_shopping_lists.idWHERE tet_items.id=(SELECT passed_id FROM passed_id)GROUP BY     tet_items.id, tet_item_info.id, tet_food_info.id, tet_brands.id;')
2025-08-14 20:38:39.613355 --- ERROR --- DatabaseError(message='column "item_id" does not existLINE 1: ...id, item_uuid as passed_uuid FROM tet_items WHERE item_id=4)...                                                             ^HINT:  Perhaps you meant to reference the column "tet_items.item_uuid".',
                                         payload=(4,),
                                         sql='WITH passed_id AS (SELECT id AS passed_id, item_uuid as passed_uuid FROM tet_items WHERE item_id=%s),    logistics_id AS (SELECT logistics_info_id FROM tet_items WHERE id=(SELECT passed_id FROM passed_id)),    info_id AS (SELECT item_info_id FROM tet_items WHERE id=(SELECT passed_id FROM passed_id)),    cte_conversions AS (        SELECT             tet_conversions.id as conv_id,            tet_conversions.conv_factor as conv_factor,            units.* as uom        FROM tet_conversions        LEFT JOIN units ON tet_conversions.uom_id = units.id        WHERE tet_conversions.item_id = (SELECT passed_id FROM passed_id)    ),    cte_item_info AS (        SELECT         tet_item_info.*,        row_to_json(units.*) as uom,        COALESCE((SELECT json_agg(convs) FROM cte_conversions convs), '[]'::json) AS conversions,        COALESCE((SELECT json_agg(p.*) FROM tet_sku_prefix as p WHERE p.id = ANY(tet_item_info.prefixes)), '[]'::json) as prefixes         FROM tet_item_info        LEFT JOIN units ON tet_item_info.uom = units.id        WHERE tet_item_info.id = (SELECT item_info_id FROM info_id)    ),    cte_shopping_lists AS (        SELECT             tet_shopping_lists.*,             tet_shopping_list_items.item_type,            tet_shopping_list_items.qty        FROM tet_shopping_lists        JOIN tet_shopping_list_items ON tet_shopping_lists.list_uuid = tet_shopping_list_items.list_uuid        WHERE tet_shopping_list_items.item_uuid = (SELECT passed_uuid FROM passed_id)    ),    cte_itemlinks AS (        SELECT * FROM tet_itemlinks WHERE link=(SELECT passed_id FROM passed_id)    ),    cte_item_locations AS (        SELECT * FROM tet_item_locations        LEFT JOIN tet_locations ON tet_locations.id = tet_item_locations.location_id        WHERE part_id = (SELECT passed_id FROM passed_id)    ),    cte_logistics_info AS (        SELECT         li.*,         row_to_json(pl) AS primary_location,        row_to_json(ail) AS auto_issue_location,        row_to_json(pz) AS primary_zone,        row_to_json(aiz) AS auto_issue_zone        FROM tet_logistics_info AS li        LEFT JOIN tet_locations AS pl ON li.primary_location = pl.id        LEFT JOIN tet_locations AS ail ON li.auto_issue_location = ail.id        LEFT JOIN tet_zones AS pz ON li.primary_zone = pz.id        LEFT JOIN tet_zones AS aiz ON li.auto_issue_zone = aiz.id        WHERE li.id=(SELECT logistics_info_id FROM logistics_id)    ),    cte_barcodes AS (        SELECT         barcode.barcode As barcode,        barcode.in_exchange AS in_exchange,        barcode.out_exchange AS out_exchange,        barcode.descriptor AS descriptor        FROM tet_barcodes AS barcode        LEFT JOIN tet_items AS item ON item.id = (SELECT passed_id FROM passed_id)        WHERE barcode.item_uuid = item.item_uuid    )SELECT    (SELECT passed_id FROM passed_id) AS passed_id,    tet_items.*,    (SELECT COALESCE(row_to_json(logis), '{}') FROM cte_logistics_info logis) AS logistics_info,    row_to_json(tet_food_info.*) as food_info,     row_to_json(tet_brands.*) as brand,    (SELECT COALESCE(row_to_json(ii), '{}') FROM cte_item_info ii) AS item_info,    (SELECT COALESCE(array_agg(row_to_json(sl)), '{}') FROM cte_shopping_lists sl) AS item_shopping_lists,    (SELECT COALESCE(array_agg(row_to_json(il)), '{}') FROM cte_itemlinks il) AS linked_items,    (SELECT COALESCE(array_agg(row_to_json(ils)), '{}') FROM cte_item_locations ils) AS item_locations,    (SELECT COALESCE(array_agg(row_to_json(bar)), '{}') FROM cte_barcodes bar) AS item_barcodesFROM tet_items    LEFT JOIN tet_item_info ON tet_items.item_info_id = tet_item_info.id     LEFT JOIN tet_food_info ON tet_items.food_info_id = tet_food_info.id     LEFT JOIN tet_brands ON tet_items.brand = tet_brands.id    LEFT JOIN units ON tet_item_info.uom = units.id     LEFT JOIN cte_shopping_lists ON tet_items.id = cte_shopping_lists.idWHERE tet_items.id=(SELECT passed_id FROM passed_id)GROUP BY     tet_items.id, tet_item_info.id, tet_food_info.id, tet_brands.id;')
2025-08-14 20:44:51.883040 --- ERROR --- DatabaseError(message='relation "tet_plan_events" does not existLINE 24: FROM tet_plan_events events              ^',
                                         payload=(2025, 8),
                                         sql='WITH arguments AS (  SELECT %s AS year, %s AS month),sum_cte AS (      SELECT mi.item_uuid, SUM(mil.quantity_on_hand)::FLOAT8 AS total_sum      FROM tet_item_locations mil      JOIN tet_items mi ON mil.part_id = mi.id      GROUP BY mi.id    ),cte_recipe_items AS (        SELECT rp_item.rp_id, rp_item.qty, COALESCE(sum_cte.total_sum, 0) as quantity_on_hand FROM tet_recipe_items rp_item        LEFT JOIN sum_cte ON sum_cte.item_uuid = rp_item.item_uuid    ), recipe_missing_items AS (  SELECT    rp_id, bool_or(qty > quantity_on_hand) AS has_missing_ingredients  FROM cte_recipe_items  GROUP BY rp_id)SELECT events.*,      COALESCE(row_to_json(recipes.*), '{}') as recipe,      COALESCE(recipe_missing_items.has_missing_ingredients, FALSE) AS has_missing_ingredientsFROM tet_plan_events eventsLEFT JOIN tet_recipes recipes ON recipes.recipe_uuid = events.recipe_uuidLEFT JOIN recipe_missing_items ON recipe_missing_items.rp_id = recipes.idWHERE  event_date_end >= make_date((SELECT year FROM arguments), (SELECT month FROM arguments), 1)  AND  event_date_start <  (make_date((SELECT year FROM arguments), (SELECT month FROM arguments), 1) + INTERVAL '1 month');')
2025-08-14 20:47:54.412888 --- ERROR --- DatabaseError(message='relation "tet_item_locations" does not existLINE 3:       FROM tet_item_locations mil                   ^',
                                         payload=['', 50, 0],
                                         sql='WITH sum_cte AS (      SELECT mi.id, SUM(mil.quantity_on_hand)::FLOAT8 AS total_sum      FROM tet_item_locations mil      JOIN tet_items mi ON mil.part_id = mi.id      GROUP BY mi.id    )SELECT item.id, item.description, item.item_name, sum_cte.total_sum as total_qoh, u.fullnameFROM tet_items itemLEFT JOIN sum_cte ON item.id = sum_cte.idLEFT JOIN tet_item_info item_info ON item.item_info_id = item_info.idLEFT JOIN units u ON item_info.uom = u.idWHERE item.search_string LIKE '%%' || %s || '%%'ORDER BY item.id ASCLIMIT %s OFFSET %s;')
2025-08-14 20:54:50.889508 --- ERROR --- DatabaseError(message='relation "tet_item_locations" does not existLINE 3:       FROM tet_item_locations mil                   ^',
                                         payload=['', 50, 0],
                                         sql='WITH sum_cte AS (      SELECT mi.id, SUM(mil.quantity_on_hand)::FLOAT8 AS total_sum      FROM tet_item_locations mil      JOIN tet_items mi ON mil.part_id = mi.id      GROUP BY mi.id    )SELECT item.id, item.description, item.item_name, sum_cte.total_sum as total_qoh, u.fullnameFROM tet_items itemLEFT JOIN sum_cte ON item.id = sum_cte.idLEFT JOIN tet_item_info item_info ON item.item_info_id = item_info.idLEFT JOIN units u ON item_info.uom = u.idWHERE item.search_string LIKE '%%' || %s || '%%'ORDER BY item.id ASCLIMIT %s OFFSET %s;')
2025-08-14 20:56:53.850782 --- ERROR --- DatabaseError(message='relation "tet_item_locations" does not existLINE 3:       FROM tet_item_locations mil                   ^',
                                         payload=['', 50, 0],
                                         sql='WITH sum_cte AS (      SELECT mi.id, SUM(mil.quantity_on_hand)::FLOAT8 AS total_sum      FROM tet_item_locations mil      JOIN tet_items mi ON mil.part_id = mi.id      GROUP BY mi.id    )SELECT item.id, item.description, item.item_name, sum_cte.total_sum as total_qoh, u.fullnameFROM tet_items itemLEFT JOIN sum_cte ON item.id = sum_cte.idLEFT JOIN tet_item_info item_info ON item.item_info_id = item_info.idLEFT JOIN units u ON item_info.uom = u.idWHERE item.search_string LIKE '%%' || %s || '%%'ORDER BY item.id ASCLIMIT %s OFFSET %s;')
2025-08-14 20:57:43.094782 --- ERROR --- DatabaseError(message='relation "tet_item_locations" does not existLINE 3:       FROM tet_item_locations mil                   ^',
                                         payload=['', 50, 0],
                                         sql='WITH sum_cte AS (      SELECT mi.id, SUM(mil.quantity_on_hand)::FLOAT8 AS total_sum      FROM tet_item_locations mil      JOIN tet_items mi ON mil.part_id = mi.id      GROUP BY mi.id    )SELECT item.id, item.description, item.item_name, sum_cte.total_sum as total_qoh, u.fullnameFROM tet_items itemLEFT JOIN sum_cte ON item.id = sum_cte.idLEFT JOIN tet_item_info item_info ON item.item_info_id = item_info.idLEFT JOIN units u ON item_info.uom = u.idWHERE item.search_string LIKE '%%' || %s || '%%'ORDER BY item.id ASCLIMIT %s OFFSET %s;')
2025-08-14 21:02:40.167097 --- ERROR --- DatabaseError(message='invalid input syntax for type uuid: "target='_blank'"',
                                         payload=("target='_blank'",),
                                         sql='WITH passed_uuid AS (SELECT %s AS passed_uuid),    cte_sl_items AS (            SELECT items.*,             (SELECT COALESCE(row_to_json(un), '{}') FROM units un WHERE un.id = items.uom LIMIT 1) AS uom            FROM test2_shopping_list_items items            WHERE items.list_uuid = (SELECT passed_uuid::uuid FROM passed_uuid)        )SELECT (SELECT passed_uuid FROM passed_uuid) AS passed_uuid,     test2_shopping_lists.*,     logins.username as author,     (SELECT COALESCE(array_agg(row_to_json(slis)), '{}') FROM cte_sl_items slis) AS sl_items  FROM test2_shopping_listsJOIN logins ON test2_shopping_lists.author = logins.idWHERE test2_shopping_lists.list_uuid=(SELECT passed_uuid::uuid FROM passed_uuid)')
2025-08-15 06:32:31.728417 --- ERROR --- DatabaseError(message='column "list_item_state" of relation "main_shopping_list_items" does not existLINE 1: UPDATE main_shopping_list_items SET list_item_state = true W...                                            ^',
                                         payload={'uuid': '9280626f-c100-44bd-a50d-35ee5d43d855', 'update': {'list_item_state': True}},
                                         sql='UPDATE main_shopping_list_items SET list_item_state = %s WHERE list_item_uuid=%s::uuid RETURNING *;')
2025-08-16 11:06:43.660699 --- ERROR --- DatabaseError(message='column main_shopping_list_items.sl_id does not existLINE 40: ...n_shopping_list_items ON main_shopping_lists.id = main_shopp...                                                              ^',
                                         payload=(196,),
                                         sql='WITH passed_id AS (SELECT %s AS passed_id),    logistics_id AS (SELECT logistics_info_id FROM main_items WHERE id=(SELECT passed_id FROM passed_id)),    info_id AS (SELECT item_info_id FROM main_items WHERE id=(SELECT passed_id FROM passed_id)),    cte_conversions AS (        SELECT             main_conversions.id as conv_id,            main_conversions.conv_factor as conv_factor,            units.* as uom        FROM main_conversions        LEFT JOIN units ON main_conversions.uom_id = units.id        WHERE main_conversions.item_id = (SELECT passed_id FROM passed_id)    ),    cte_item_info AS (        SELECT         main_item_info.*,        row_to_json(units.*) as uom,        COALESCE((SELECT json_agg(convs) FROM cte_conversions convs), '[]'::json) AS conversions,        COALESCE((SELECT json_agg(p.*) FROM main_sku_prefix as p WHERE p.id = ANY(main_item_info.prefixes)), '[]'::json) as prefixes         FROM main_item_info        LEFT JOIN units ON main_item_info.uom = units.id        WHERE main_item_info.id = (SELECT item_info_id FROM info_id)    ),    cte_groups AS (        SELECT             main_groups.*,             main_group_items.uuid,            main_group_items.item_type,            main_group_items.qty        FROM main_groups        JOIN main_group_items ON main_groups.id = main_group_items.gr_id        WHERE main_group_items.item_id = (SELECT passed_id FROM passed_id)    ),    cte_shopping_lists AS (        SELECT             main_shopping_lists.*,             main_shopping_list_items.uuid,            main_shopping_list_items.item_type,            main_shopping_list_items.qty        FROM main_shopping_lists        JOIN main_shopping_list_items ON main_shopping_lists.id = main_shopping_list_items.sl_id        WHERE main_shopping_list_items.item_id = (SELECT passed_id FROM passed_id)    ),    cte_itemlinks AS (        SELECT * FROM main_itemlinks WHERE link=(SELECT passed_id FROM passed_id)    ),    cte_item_locations AS (        SELECT * FROM main_item_locations        LEFT JOIN main_locations ON main_locations.id = main_item_locations.location_id        WHERE part_id = (SELECT passed_id FROM passed_id)    ),    cte_logistics_info AS (        SELECT         li.*,         row_to_json(pl) AS primary_location,        row_to_json(ail) AS auto_issue_location,        row_to_json(pz) AS primary_zone,        row_to_json(aiz) AS auto_issue_zone        FROM main_logistics_info AS li        LEFT JOIN main_locations AS pl ON li.primary_location = pl.id        LEFT JOIN main_locations AS ail ON li.auto_issue_location = ail.id        LEFT JOIN main_zones AS pz ON li.primary_zone = pz.id        LEFT JOIN main_zones AS aiz ON li.auto_issue_zone = aiz.id        WHERE li.id=(SELECT logistics_info_id FROM logistics_id)    )SELECT    (SELECT passed_id FROM passed_id) AS passed_id,    main_items.*,    (SELECT COALESCE(row_to_json(logis), '{}') FROM cte_logistics_info logis) AS logistics_info,    row_to_json(main_food_info.*) as food_info,     row_to_json(main_brands.*) as brand,    (SELECT COALESCE(row_to_json(ii), '{}') FROM cte_item_info ii) AS item_info,    (SELECT COALESCE(array_agg(row_to_json(g)), '{}') FROM cte_groups g) AS item_groups,    (SELECT COALESCE(array_agg(row_to_json(sl)), '{}') FROM cte_shopping_lists sl) AS item_shopping_lists,    (SELECT COALESCE(array_agg(row_to_json(il)), '{}') FROM cte_itemlinks il) AS linked_items,    (SELECT COALESCE(array_agg(row_to_json(ils)), '{}') FROM cte_item_locations ils) AS item_locationsFROM main_items    LEFT JOIN main_item_info ON main_items.item_info_id = main_item_info.id     LEFT JOIN main_food_info ON main_items.food_info_id = main_food_info.id     LEFT JOIN main_brands ON main_items.brand = main_brands.id    LEFT JOIN units ON main_item_info.uom = units.id     LEFT JOIN cte_groups ON main_items.id = cte_groups.id    LEFT JOIN cte_shopping_lists ON main_items.id = cte_shopping_lists.idWHERE main_items.id=(SELECT passed_id FROM passed_id)GROUP BY     main_items.id, main_item_info.id, main_food_info.id, main_brands.id;')
2025-08-16 11:07:04.722280 --- ERROR --- DatabaseError(message='column main_shopping_list_items.sl_id does not existLINE 40: ...n_shopping_list_items ON main_shopping_lists.id = main_shopp...                                                              ^',
                                         payload=(196,),
                                         sql='WITH passed_id AS (SELECT %s AS passed_id),    logistics_id AS (SELECT logistics_info_id FROM main_items WHERE id=(SELECT passed_id FROM passed_id)),    info_id AS (SELECT item_info_id FROM main_items WHERE id=(SELECT passed_id FROM passed_id)),    cte_conversions AS (        SELECT             main_conversions.id as conv_id,            main_conversions.conv_factor as conv_factor,            units.* as uom        FROM main_conversions        LEFT JOIN units ON main_conversions.uom_id = units.id        WHERE main_conversions.item_id = (SELECT passed_id FROM passed_id)    ),    cte_item_info AS (        SELECT         main_item_info.*,        row_to_json(units.*) as uom,        COALESCE((SELECT json_agg(convs) FROM cte_conversions convs), '[]'::json) AS conversions,        COALESCE((SELECT json_agg(p.*) FROM main_sku_prefix as p WHERE p.id = ANY(main_item_info.prefixes)), '[]'::json) as prefixes         FROM main_item_info        LEFT JOIN units ON main_item_info.uom = units.id        WHERE main_item_info.id = (SELECT item_info_id FROM info_id)    ),    cte_groups AS (        SELECT             main_groups.*,             main_group_items.uuid,            main_group_items.item_type,            main_group_items.qty        FROM main_groups        JOIN main_group_items ON main_groups.id = main_group_items.gr_id        WHERE main_group_items.item_id = (SELECT passed_id FROM passed_id)    ),    cte_shopping_lists AS (        SELECT             main_shopping_lists.*,             main_shopping_list_items.uuid,            main_shopping_list_items.item_type,            main_shopping_list_items.qty        FROM main_shopping_lists        JOIN main_shopping_list_items ON main_shopping_lists.id = main_shopping_list_items.sl_id        WHERE main_shopping_list_items.item_id = (SELECT passed_id FROM passed_id)    ),    cte_itemlinks AS (        SELECT * FROM main_itemlinks WHERE link=(SELECT passed_id FROM passed_id)    ),    cte_item_locations AS (        SELECT * FROM main_item_locations        LEFT JOIN main_locations ON main_locations.id = main_item_locations.location_id        WHERE part_id = (SELECT passed_id FROM passed_id)    ),    cte_logistics_info AS (        SELECT         li.*,         row_to_json(pl) AS primary_location,        row_to_json(ail) AS auto_issue_location,        row_to_json(pz) AS primary_zone,        row_to_json(aiz) AS auto_issue_zone        FROM main_logistics_info AS li        LEFT JOIN main_locations AS pl ON li.primary_location = pl.id        LEFT JOIN main_locations AS ail ON li.auto_issue_location = ail.id        LEFT JOIN main_zones AS pz ON li.primary_zone = pz.id        LEFT JOIN main_zones AS aiz ON li.auto_issue_zone = aiz.id        WHERE li.id=(SELECT logistics_info_id FROM logistics_id)    )SELECT    (SELECT passed_id FROM passed_id) AS passed_id,    main_items.*,    (SELECT COALESCE(row_to_json(logis), '{}') FROM cte_logistics_info logis) AS logistics_info,    row_to_json(main_food_info.*) as food_info,     row_to_json(main_brands.*) as brand,    (SELECT COALESCE(row_to_json(ii), '{}') FROM cte_item_info ii) AS item_info,    (SELECT COALESCE(array_agg(row_to_json(g)), '{}') FROM cte_groups g) AS item_groups,    (SELECT COALESCE(array_agg(row_to_json(sl)), '{}') FROM cte_shopping_lists sl) AS item_shopping_lists,    (SELECT COALESCE(array_agg(row_to_json(il)), '{}') FROM cte_itemlinks il) AS linked_items,    (SELECT COALESCE(array_agg(row_to_json(ils)), '{}') FROM cte_item_locations ils) AS item_locationsFROM main_items    LEFT JOIN main_item_info ON main_items.item_info_id = main_item_info.id     LEFT JOIN main_food_info ON main_items.food_info_id = main_food_info.id     LEFT JOIN main_brands ON main_items.brand = main_brands.id    LEFT JOIN units ON main_item_info.uom = units.id     LEFT JOIN cte_groups ON main_items.id = cte_groups.id    LEFT JOIN cte_shopping_lists ON main_items.id = cte_shopping_lists.idWHERE main_items.id=(SELECT passed_id FROM passed_id)GROUP BY     main_items.id, main_item_info.id, main_food_info.id, main_brands.id;')
2025-08-16 11:23:59.868804 --- ERROR --- DatabaseError(message='column main_shopping_list_items.sl_id does not existLINE 40: ...n_shopping_list_items ON main_shopping_lists.id = main_shopp...                                                              ^',
                                         payload=(196,),
                                         sql='WITH passed_id AS (SELECT %s AS passed_id),    logistics_id AS (SELECT logistics_info_id FROM main_items WHERE id=(SELECT passed_id FROM passed_id)),    info_id AS (SELECT item_info_id FROM main_items WHERE id=(SELECT passed_id FROM passed_id)),    cte_conversions AS (        SELECT             main_conversions.id as conv_id,            main_conversions.conv_factor as conv_factor,            units.* as uom        FROM main_conversions        LEFT JOIN units ON main_conversions.uom_id = units.id        WHERE main_conversions.item_id = (SELECT passed_id FROM passed_id)    ),    cte_item_info AS (        SELECT         main_item_info.*,        row_to_json(units.*) as uom,        COALESCE((SELECT json_agg(convs) FROM cte_conversions convs), '[]'::json) AS conversions,        COALESCE((SELECT json_agg(p.*) FROM main_sku_prefix as p WHERE p.id = ANY(main_item_info.prefixes)), '[]'::json) as prefixes         FROM main_item_info        LEFT JOIN units ON main_item_info.uom = units.id        WHERE main_item_info.id = (SELECT item_info_id FROM info_id)    ),    cte_groups AS (        SELECT             main_groups.*,             main_group_items.uuid,            main_group_items.item_type,            main_group_items.qty        FROM main_groups        JOIN main_group_items ON main_groups.id = main_group_items.gr_id        WHERE main_group_items.item_id = (SELECT passed_id FROM passed_id)    ),    cte_shopping_lists AS (        SELECT             main_shopping_lists.*,             main_shopping_list_items.uuid,            main_shopping_list_items.item_type,            main_shopping_list_items.qty        FROM main_shopping_lists        JOIN main_shopping_list_items ON main_shopping_lists.id = main_shopping_list_items.sl_id        WHERE main_shopping_list_items.item_id = (SELECT passed_id FROM passed_id)    ),    cte_itemlinks AS (        SELECT * FROM main_itemlinks WHERE link=(SELECT passed_id FROM passed_id)    ),    cte_item_locations AS (        SELECT * FROM main_item_locations        LEFT JOIN main_locations ON main_locations.id = main_item_locations.location_id        WHERE part_id = (SELECT passed_id FROM passed_id)    ),    cte_logistics_info AS (        SELECT         li.*,         row_to_json(pl) AS primary_location,        row_to_json(ail) AS auto_issue_location,        row_to_json(pz) AS primary_zone,        row_to_json(aiz) AS auto_issue_zone        FROM main_logistics_info AS li        LEFT JOIN main_locations AS pl ON li.primary_location = pl.id        LEFT JOIN main_locations AS ail ON li.auto_issue_location = ail.id        LEFT JOIN main_zones AS pz ON li.primary_zone = pz.id        LEFT JOIN main_zones AS aiz ON li.auto_issue_zone = aiz.id        WHERE li.id=(SELECT logistics_info_id FROM logistics_id)    )SELECT    (SELECT passed_id FROM passed_id) AS passed_id,    main_items.*,    (SELECT COALESCE(row_to_json(logis), '{}') FROM cte_logistics_info logis) AS logistics_info,    row_to_json(main_food_info.*) as food_info,     row_to_json(main_brands.*) as brand,    (SELECT COALESCE(row_to_json(ii), '{}') FROM cte_item_info ii) AS item_info,    (SELECT COALESCE(array_agg(row_to_json(g)), '{}') FROM cte_groups g) AS item_groups,    (SELECT COALESCE(array_agg(row_to_json(sl)), '{}') FROM cte_shopping_lists sl) AS item_shopping_lists,    (SELECT COALESCE(array_agg(row_to_json(il)), '{}') FROM cte_itemlinks il) AS linked_items,    (SELECT COALESCE(array_agg(row_to_json(ils)), '{}') FROM cte_item_locations ils) AS item_locationsFROM main_items    LEFT JOIN main_item_info ON main_items.item_info_id = main_item_info.id     LEFT JOIN main_food_info ON main_items.food_info_id = main_food_info.id     LEFT JOIN main_brands ON main_items.brand = main_brands.id    LEFT JOIN units ON main_item_info.uom = units.id     LEFT JOIN cte_groups ON main_items.id = cte_groups.id    LEFT JOIN cte_shopping_lists ON main_items.id = cte_shopping_lists.idWHERE main_items.id=(SELECT passed_id FROM passed_id)GROUP BY     main_items.id, main_item_info.id, main_food_info.id, main_brands.id;')
2025-08-16 17:04:26.272090 --- ERROR --- DatabaseError(message='invalid reference to FROM-clause entry for table "main_items"LINE 7: WHERE main_items.search_string LIKE '%' || '' || '%'               ^HINT:  Perhaps you meant to reference the table alias "items".',
                                         payload=('', 50, 0),
                                         sql='SELECT items.item_uuid,    items.item_name,    units.fullnameFROM main_items itemsLEFT JOIN main_item_info item_info ON item_info.id = items.item_info_idLEFT JOIN units ON item_info.uom = units.idWHERE main_items.search_string LIKE '%%' || %s || '%%' ORDER BY items.item_name LIMIT %s OFFSET %s;')
2025-08-17 19:21:27.673759 --- ERROR --- DatabaseError(message='duplicate key value violates unique constraint "main_logistics_info_barcode_key"DETAIL:  Key (barcode)=(%%) already exists.',
                                         payload=('%%', 1, 1, 1, 1),
                                         sql='INSERT INTO main_logistics_info(barcode, primary_location, primary_zone, auto_issue_location, auto_issue_zone) VALUES (%s, %s, %s, %s, %s) RETURNING *;')
2025-08-17 19:21:30.048853 --- ERROR --- DatabaseError(message='duplicate key value violates unique constraint "main_logistics_info_barcode_key"DETAIL:  Key (barcode)=(%%) already exists.',
                                         payload=('%%', 1, 1, 1, 1),
                                         sql='INSERT INTO main_logistics_info(barcode, primary_location, primary_zone, auto_issue_location, auto_issue_zone) VALUES (%s, %s, %s, %s, %s) RETURNING *;')
2025-08-17 19:22:32.824380 --- ERROR --- DatabaseError(message='duplicate key value violates unique constraint "main_item_info_barcode_key"DETAIL:  Key (barcode)=(%%) already exists.',
                                         payload=('%%', '', 1.0, 1, 0.0, 0.0, 0.0, False, '{}'),
                                         sql='INSERT INTO main_item_info(barcode, packaging, uom_quantity, uom, cost, safety_stock, lead_time_days, ai_pick, prefixes) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s) RETURNING *;')
2025-08-19 14:46:59.332054 --- ERROR --- DatabaseError(message='duplicate key value violates unique constraint "main_barcodes_pkey"DETAIL:  Key (barcode)=(%181945000062%) already exists.',
                                         payload=('%181945000062%', 'faecba1e-8817-4e19-9ade-d43cb4602aae', '1', '1', ''),
                                         sql='INSERT INTO main_barcodes (barcode, item_uuid, in_exchange, out_exchange, descriptor) VALUES (%s, %s, %s, %s, %s) RETURNING *;')
2025-08-19 15:39:25.102811 --- ERROR --- DatabaseError(message='dict is not a sequence',
                                         payload={'item_uuid': '392f05b5-4ccd-41da-875d-0e593f51b610'},
                                         sql='WITH sum_cte AS (  SELECT mi.id, SUM(mil.quantity_on_hand) AS total_sum  FROM main_item_locations mil  JOIN main_items mi ON mil.part_id = mi.id  GROUP BY mi.id)SELECT * FROM main_items itemsLEFT JOIN main_item_info ON main_items.item_info_id = main_item_info.idLEFT JOIN units ON units.id = main_item_info.uomLEFT JOIN sum_cte ON main_items.id = sum_cte.idWHERE items.item_uuid = %{item_uuid}s')
2025-08-19 15:43:08.370309 --- ERROR --- DatabaseError(message='invalid reference to FROM-clause entry for table "main_items"LINE 10: LEFT JOIN main_item_info ON main_items.item_info_id = main_i...                                     ^HINT:  Perhaps you meant to reference the table alias "items".',
                                         payload={'item_uuid': '392f05b5-4ccd-41da-875d-0e593f51b610'},
                                         sql='WITH sum_cte AS (  SELECT mi.id, SUM(mil.quantity_on_hand) AS total_sum  FROM main_item_locations mil  JOIN main_items mi ON mil.part_id = mi.id  GROUP BY mi.id)SELECT * FROM main_items itemsLEFT JOIN main_item_info ON main_items.item_info_id = main_item_info.idLEFT JOIN units ON units.id = main_item_info.uomLEFT JOIN sum_cte ON main_items.id = sum_cte.idWHERE items.item_uuid = %(item_uuid)s')
2025-08-19 15:45:09.890974 --- ERROR --- DatabaseError(message='syntax error at or near "FROM"LINE 11: FROM main_items items         ^',
                                         payload={'item_uuid': '392f05b5-4ccd-41da-875d-0e593f51b610'},
                                         sql='WITH sum_cte AS (  SELECT mi.id, SUM(mil.quantity_on_hand) AS total_sum  FROM main_item_locations mil  JOIN main_items mi ON mil.part_id = mi.id  GROUP BY mi.id)SELECT main_items.*,    COALESCE(row_to_json(main_item_info.*), '{}') AS item_info,    COALESCE(sum_cte.total_sum, 0) AS total_sum,FROM main_items itemsLEFT JOIN main_item_info item_info ON items.item_info_id = item_info.idLEFT JOIN units ON units.id = item_info.uomLEFT JOIN sum_cte ON items.id = sum_cte.idWHERE items.item_uuid = %(item_uuid)s')
2025-08-19 15:45:32.184317 --- ERROR --- DatabaseError(message='syntax error at or near "FROM"LINE 11: FROM main_items items         ^',
                                         payload={'item_uuid': '392f05b5-4ccd-41da-875d-0e593f51b610'},
                                         sql='WITH sum_cte AS (  SELECT mi.id, SUM(mil.quantity_on_hand) AS total_sum  FROM main_item_locations mil  JOIN main_items mi ON mil.part_id = mi.id  GROUP BY mi.id)SELECT items.*,    COALESCE(row_to_json(item_info.*), '{}') AS item_info,    COALESCE(sum_cte.total_sum, 0) AS total_sum,FROM main_items itemsLEFT JOIN main_item_info item_info ON items.item_info_id = item_info.idLEFT JOIN units ON units.id = item_info.uomLEFT JOIN sum_cte ON items.id = sum_cte.idWHERE items.item_uuid = %(item_uuid)s')
2025-08-19 17:38:27.622014 --- ERROR --- DatabaseError(message='syntax error at or near ")"LINE 1: ...WHERE main_shopping_list_items.list_item_uuid IN () RETURNIN...                                                             ^',
                                         payload=[],
                                         sql='WITH deleted_rows AS (DELETE FROM main_shopping_list_items WHERE main_shopping_list_items.list_item_uuid IN () RETURNING *) SELECT * FROM deleted_rows;')
2025-08-19 17:39:39.750553 --- ERROR --- DatabaseError(message='syntax error at or near ")"LINE 1: ...WHERE main_shopping_list_items.list_item_uuid IN () RETURNIN...                                                             ^',
                                         payload=[],
                                         sql='WITH deleted_rows AS (DELETE FROM main_shopping_list_items WHERE main_shopping_list_items.list_item_uuid IN () RETURNING *) SELECT * FROM deleted_rows;')
2025-08-19 17:55:16.825854 --- ERROR --- DatabaseError(message='duplicate key value violates unique constraint "main_shopping_lists_name_key"DETAIL:  Key (name)=() already exists.',
                                         payload=('', '', 1, datetime.datetime(2025, 8, 19, 17, 55, 16, 816288), 'plain', 'temporary'),
                                         sql='INSERT INTO main_shopping_lists(name, description, author, creation_date, sub_type, list_type) VALUES (%s, %s, %s, %s, %s, %s) RETURNING *;')
2025-08-20 05:17:43.764499 --- ERROR --- DatabaseError(message='syntax error at or near ")"LINE 1: ...WHERE main_shopping_list_items.list_item_uuid IN () RETURNIN...                                                             ^',
                                         payload=[],
                                         sql='WITH deleted_rows AS (DELETE FROM main_shopping_list_items WHERE main_shopping_list_items.list_item_uuid IN () RETURNING *) SELECT * FROM deleted_rows;')
2025-08-20 05:17:54.498269 --- ERROR --- DatabaseError(message='syntax error at or near ")"LINE 1: ...WHERE main_shopping_list_items.list_item_uuid IN () RETURNIN...                                                             ^',
                                         payload=[],
                                         sql='WITH deleted_rows AS (DELETE FROM main_shopping_list_items WHERE main_shopping_list_items.list_item_uuid IN () RETURNING *) SELECT * FROM deleted_rows;')
2025-08-20 05:17:57.313016 --- ERROR --- DatabaseError(message='syntax error at or near ")"LINE 1: ...WHERE main_shopping_list_items.list_item_uuid IN () RETURNIN...                                                             ^',
                                         payload=[],
                                         sql='WITH deleted_rows AS (DELETE FROM main_shopping_list_items WHERE main_shopping_list_items.list_item_uuid IN () RETURNING *) SELECT * FROM deleted_rows;')
2025-08-20 15:32:51.822870 --- ERROR --- DatabaseError(message='duplicate key value violates unique constraint "main_shopping_lists_name_key"DETAIL:  Key (name)=(test) already exists.',
                                         payload=('test', 'test', 1, datetime.datetime(2025, 8, 20, 15, 32, 51, 814595), 'plain', 'temporary'),
                                         sql='INSERT INTO main_shopping_lists(name, description, author, creation_date, sub_type, list_type) VALUES (%s, %s, %s, %s, %s, %s) RETURNING *;')
2025-08-20 15:38:30.303845 --- ERROR --- DatabaseError(message='column "start_date" does not existLINE 1: ... FROM main_plan_events WHERE plan_uuid = NULL AND start_date...                                                             ^',
                                         payload={'start_date': '2025-08-18', 'end_date': '2025-08-24', 'plan_uuid': None, 'plan_name': 'Site Planner'},
                                         sql='SELECT * FROM main_plan_events WHERE plan_uuid = %(plan_uuid)s AND start_date <= %(end_date)s AND end_date >= %(start_date)s;')
2025-08-21 15:30:18.587714 --- ERROR --- DatabaseError(message='missing FROM-clause entry for table "rpcipe"LINE 34:             rpcipe.*,                      ^',
                                         payload=(1,),
                                         sql='WITH passed_id AS (SELECT id AS passed_id, item_uuid as passed_uuid FROM main_items WHERE id=%s),    logistics_id AS (SELECT logistics_info_id FROM main_items WHERE id=(SELECT passed_id FROM passed_id)),    info_id AS (SELECT item_info_id FROM main_items WHERE id=(SELECT passed_id FROM passed_id)),    cte_conversions AS (        SELECT             main_conversions.id as conv_id,            main_conversions.conv_factor as conv_factor,            units.* as uom        FROM main_conversions        LEFT JOIN units ON main_conversions.uom_id = units.id        WHERE main_conversions.item_id = (SELECT passed_id FROM passed_id)    ),    cte_item_info AS (        SELECT         main_item_info.*,        row_to_json(units.*) as uom,        COALESCE((SELECT json_agg(convs) FROM cte_conversions convs), '[]'::json) AS conversions,        COALESCE((SELECT json_agg(p.*) FROM main_sku_prefix as p WHERE p.id = ANY(main_item_info.prefixes)), '[]'::json) as prefixes         FROM main_item_info        LEFT JOIN units ON main_item_info.uom = units.id        WHERE main_item_info.id = (SELECT item_info_id FROM info_id)    ),    cte_shopping_lists AS (        SELECT             main_shopping_lists.*,             main_shopping_list_items.item_type,            main_shopping_list_items.qty        FROM main_shopping_lists        JOIN main_shopping_list_items ON main_shopping_lists.list_uuid = main_shopping_list_items.list_uuid        WHERE main_shopping_list_items.item_uuid = (SELECT passed_uuid FROM passed_id)    ),    cte_recipes AS (        SELECT             rpcipe.*,             rp_item.item_type,            rp_item.qty        FROM main_recipes recipe        JOIN main_recipe_items rp_items ON recipe.id = rp_items.rp_id        WHERE rp_items.item_uuid = (SELECT passed_uuid FROM passed_id)    ),    cte_itemlinks AS (        SELECT * FROM main_itemlinks WHERE link=(SELECT passed_id FROM passed_id)    ),    cte_item_locations AS (        SELECT * FROM main_item_locations        LEFT JOIN main_locations ON main_locations.id = main_item_locations.location_id        WHERE part_id = (SELECT passed_id FROM passed_id)    ),    cte_logistics_info AS (        SELECT         li.*,         row_to_json(pl) AS primary_location,        row_to_json(ail) AS auto_issue_location,        row_to_json(pz) AS primary_zone,        row_to_json(aiz) AS auto_issue_zone        FROM main_logistics_info AS li        LEFT JOIN main_locations AS pl ON li.primary_location = pl.id        LEFT JOIN main_locations AS ail ON li.auto_issue_location = ail.id        LEFT JOIN main_zones AS pz ON li.primary_zone = pz.id        LEFT JOIN main_zones AS aiz ON li.auto_issue_zone = aiz.id        WHERE li.id=(SELECT logistics_info_id FROM logistics_id)    ),    cte_barcodes AS (        SELECT         barcode.barcode As barcode,        barcode.in_exchange AS in_exchange,        barcode.out_exchange AS out_exchange,        barcode.descriptor AS descriptor        FROM main_barcodes AS barcode        LEFT JOIN main_items AS item ON item.id = (SELECT passed_id FROM passed_id)        WHERE barcode.item_uuid = item.item_uuid    )SELECT    (SELECT passed_id FROM passed_id) AS passed_id,    main_items.*,    (SELECT COALESCE(row_to_json(logis), '{}') FROM cte_logistics_info logis) AS logistics_info,    row_to_json(main_food_info.*) as food_info,     row_to_json(main_brands.*) as brand,    (SELECT COALESCE(row_to_json(ii), '{}') FROM cte_item_info ii) AS item_info,    (SELECT COALESCE(array_agg(row_to_json(sl)), '{}') FROM cte_shopping_lists sl) AS item_shopping_lists,    (SELECT COALESCE(array_agg(row_to_json(rp)), '{}') FROM cte_recipes sl) AS item_recipes,    (SELECT COALESCE(array_agg(row_to_json(il)), '{}') FROM cte_itemlinks il) AS linked_items,    (SELECT COALESCE(array_agg(row_to_json(ils)), '{}') FROM cte_item_locations ils) AS item_locations,    (SELECT COALESCE(array_agg(row_to_json(bar)), '{}') FROM cte_barcodes bar) AS item_barcodesFROM main_items    LEFT JOIN main_item_info ON main_items.item_info_id = main_item_info.id     LEFT JOIN main_food_info ON main_items.food_info_id = main_food_info.id     LEFT JOIN main_brands ON main_items.brand = main_brands.id    LEFT JOIN units ON main_item_info.uom = units.id     LEFT JOIN cte_shopping_lists ON main_items.id = cte_shopping_lists.id    LEFT JOIN cte_recipes ON main_items.id = cte_recipes.idWHERE main_items.id=(SELECT passed_id FROM passed_id)GROUP BY     main_items.id, main_item_info.id, main_food_info.id, main_brands.id;')
2025-08-21 15:31:10.416198 --- ERROR --- DatabaseError(message='missing FROM-clause entry for table "rp_item"LINE 35:             rp_item.item_type,                     ^',
                                         payload=(1,),
                                         sql='WITH passed_id AS (SELECT id AS passed_id, item_uuid as passed_uuid FROM main_items WHERE id=%s),    logistics_id AS (SELECT logistics_info_id FROM main_items WHERE id=(SELECT passed_id FROM passed_id)),    info_id AS (SELECT item_info_id FROM main_items WHERE id=(SELECT passed_id FROM passed_id)),    cte_conversions AS (        SELECT             main_conversions.id as conv_id,            main_conversions.conv_factor as conv_factor,            units.* as uom        FROM main_conversions        LEFT JOIN units ON main_conversions.uom_id = units.id        WHERE main_conversions.item_id = (SELECT passed_id FROM passed_id)    ),    cte_item_info AS (        SELECT         main_item_info.*,        row_to_json(units.*) as uom,        COALESCE((SELECT json_agg(convs) FROM cte_conversions convs), '[]'::json) AS conversions,        COALESCE((SELECT json_agg(p.*) FROM main_sku_prefix as p WHERE p.id = ANY(main_item_info.prefixes)), '[]'::json) as prefixes         FROM main_item_info        LEFT JOIN units ON main_item_info.uom = units.id        WHERE main_item_info.id = (SELECT item_info_id FROM info_id)    ),    cte_shopping_lists AS (        SELECT             main_shopping_lists.*,             main_shopping_list_items.item_type,            main_shopping_list_items.qty        FROM main_shopping_lists        JOIN main_shopping_list_items ON main_shopping_lists.list_uuid = main_shopping_list_items.list_uuid        WHERE main_shopping_list_items.item_uuid = (SELECT passed_uuid FROM passed_id)    ),    cte_recipes AS (        SELECT             recipe.*,             rp_item.item_type,            rp_item.qty        FROM main_recipes recipe        JOIN main_recipe_items rp_items ON recipe.id = rp_items.rp_id        WHERE rp_items.item_uuid = (SELECT passed_uuid FROM passed_id)    ),    cte_itemlinks AS (        SELECT * FROM main_itemlinks WHERE link=(SELECT passed_id FROM passed_id)    ),    cte_item_locations AS (        SELECT * FROM main_item_locations        LEFT JOIN main_locations ON main_locations.id = main_item_locations.location_id        WHERE part_id = (SELECT passed_id FROM passed_id)    ),    cte_logistics_info AS (        SELECT         li.*,         row_to_json(pl) AS primary_location,        row_to_json(ail) AS auto_issue_location,        row_to_json(pz) AS primary_zone,        row_to_json(aiz) AS auto_issue_zone        FROM main_logistics_info AS li        LEFT JOIN main_locations AS pl ON li.primary_location = pl.id        LEFT JOIN main_locations AS ail ON li.auto_issue_location = ail.id        LEFT JOIN main_zones AS pz ON li.primary_zone = pz.id        LEFT JOIN main_zones AS aiz ON li.auto_issue_zone = aiz.id        WHERE li.id=(SELECT logistics_info_id FROM logistics_id)    ),    cte_barcodes AS (        SELECT         barcode.barcode As barcode,        barcode.in_exchange AS in_exchange,        barcode.out_exchange AS out_exchange,        barcode.descriptor AS descriptor        FROM main_barcodes AS barcode        LEFT JOIN main_items AS item ON item.id = (SELECT passed_id FROM passed_id)        WHERE barcode.item_uuid = item.item_uuid    )SELECT    (SELECT passed_id FROM passed_id) AS passed_id,    main_items.*,    (SELECT COALESCE(row_to_json(logis), '{}') FROM cte_logistics_info logis) AS logistics_info,    row_to_json(main_food_info.*) as food_info,     row_to_json(main_brands.*) as brand,    (SELECT COALESCE(row_to_json(ii), '{}') FROM cte_item_info ii) AS item_info,    (SELECT COALESCE(array_agg(row_to_json(sl)), '{}') FROM cte_shopping_lists sl) AS item_shopping_lists,    (SELECT COALESCE(array_agg(row_to_json(rp)), '{}') FROM cte_recipes sl) AS item_recipes,    (SELECT COALESCE(array_agg(row_to_json(il)), '{}') FROM cte_itemlinks il) AS linked_items,    (SELECT COALESCE(array_agg(row_to_json(ils)), '{}') FROM cte_item_locations ils) AS item_locations,    (SELECT COALESCE(array_agg(row_to_json(bar)), '{}') FROM cte_barcodes bar) AS item_barcodesFROM main_items    LEFT JOIN main_item_info ON main_items.item_info_id = main_item_info.id     LEFT JOIN main_food_info ON main_items.food_info_id = main_food_info.id     LEFT JOIN main_brands ON main_items.brand = main_brands.id    LEFT JOIN units ON main_item_info.uom = units.id     LEFT JOIN cte_shopping_lists ON main_items.id = cte_shopping_lists.id    LEFT JOIN cte_recipes ON main_items.id = cte_recipes.idWHERE main_items.id=(SELECT passed_id FROM passed_id)GROUP BY     main_items.id, main_item_info.id, main_food_info.id, main_brands.id;')
2025-08-21 15:32:08.445090 --- ERROR --- DatabaseError(message='syntax error at or near "FROM"LINE 35:         FROM main_recipe_items rp_items                 ^',
                                         payload=(1,),
                                         sql='WITH passed_id AS (SELECT id AS passed_id, item_uuid as passed_uuid FROM main_items WHERE id=%s),    logistics_id AS (SELECT logistics_info_id FROM main_items WHERE id=(SELECT passed_id FROM passed_id)),    info_id AS (SELECT item_info_id FROM main_items WHERE id=(SELECT passed_id FROM passed_id)),    cte_conversions AS (        SELECT             main_conversions.id as conv_id,            main_conversions.conv_factor as conv_factor,            units.* as uom        FROM main_conversions        LEFT JOIN units ON main_conversions.uom_id = units.id        WHERE main_conversions.item_id = (SELECT passed_id FROM passed_id)    ),    cte_item_info AS (        SELECT         main_item_info.*,        row_to_json(units.*) as uom,        COALESCE((SELECT json_agg(convs) FROM cte_conversions convs), '[]'::json) AS conversions,        COALESCE((SELECT json_agg(p.*) FROM main_sku_prefix as p WHERE p.id = ANY(main_item_info.prefixes)), '[]'::json) as prefixes         FROM main_item_info        LEFT JOIN units ON main_item_info.uom = units.id        WHERE main_item_info.id = (SELECT item_info_id FROM info_id)    ),    cte_shopping_lists AS (        SELECT             main_shopping_lists.*,             main_shopping_list_items.item_type,            main_shopping_list_items.qty        FROM main_shopping_lists        JOIN main_shopping_list_items ON main_shopping_lists.list_uuid = main_shopping_list_items.list_uuid        WHERE main_shopping_list_items.item_uuid = (SELECT passed_uuid FROM passed_id)    ),    cte_recipes AS (        SELECT             rp_items.*,         FROM main_recipe_items rp_items        WHERE rp_items.item_uuid = (SELECT passed_uuid FROM passed_id)    ),    cte_itemlinks AS (        SELECT * FROM main_itemlinks WHERE link=(SELECT passed_id FROM passed_id)    ),    cte_item_locations AS (        SELECT * FROM main_item_locations        LEFT JOIN main_locations ON main_locations.id = main_item_locations.location_id        WHERE part_id = (SELECT passed_id FROM passed_id)    ),    cte_logistics_info AS (        SELECT         li.*,         row_to_json(pl) AS primary_location,        row_to_json(ail) AS auto_issue_location,        row_to_json(pz) AS primary_zone,        row_to_json(aiz) AS auto_issue_zone        FROM main_logistics_info AS li        LEFT JOIN main_locations AS pl ON li.primary_location = pl.id        LEFT JOIN main_locations AS ail ON li.auto_issue_location = ail.id        LEFT JOIN main_zones AS pz ON li.primary_zone = pz.id        LEFT JOIN main_zones AS aiz ON li.auto_issue_zone = aiz.id        WHERE li.id=(SELECT logistics_info_id FROM logistics_id)    ),    cte_barcodes AS (        SELECT         barcode.barcode As barcode,        barcode.in_exchange AS in_exchange,        barcode.out_exchange AS out_exchange,        barcode.descriptor AS descriptor        FROM main_barcodes AS barcode        LEFT JOIN main_items AS item ON item.id = (SELECT passed_id FROM passed_id)        WHERE barcode.item_uuid = item.item_uuid    )SELECT    (SELECT passed_id FROM passed_id) AS passed_id,    main_items.*,    (SELECT COALESCE(row_to_json(logis), '{}') FROM cte_logistics_info logis) AS logistics_info,    row_to_json(main_food_info.*) as food_info,     row_to_json(main_brands.*) as brand,    (SELECT COALESCE(row_to_json(ii), '{}') FROM cte_item_info ii) AS item_info,    (SELECT COALESCE(array_agg(row_to_json(sl)), '{}') FROM cte_shopping_lists sl) AS item_shopping_lists,    (SELECT COALESCE(array_agg(row_to_json(rp)), '{}') FROM cte_recipes rp) AS item_recipes,    (SELECT COALESCE(array_agg(row_to_json(il)), '{}') FROM cte_itemlinks il) AS linked_items,    (SELECT COALESCE(array_agg(row_to_json(ils)), '{}') FROM cte_item_locations ils) AS item_locations,    (SELECT COALESCE(array_agg(row_to_json(bar)), '{}') FROM cte_barcodes bar) AS item_barcodesFROM main_items    LEFT JOIN main_item_info ON main_items.item_info_id = main_item_info.id     LEFT JOIN main_food_info ON main_items.food_info_id = main_food_info.id     LEFT JOIN main_brands ON main_items.brand = main_brands.id    LEFT JOIN units ON main_item_info.uom = units.id     LEFT JOIN cte_shopping_lists ON main_items.id = cte_shopping_lists.id    LEFT JOIN cte_recipes ON main_items.id = cte_recipes.idWHERE main_items.id=(SELECT passed_id FROM passed_id)GROUP BY     main_items.id, main_item_info.id, main_food_info.id, main_brands.id;')
2025-08-21 15:32:41.827889 --- ERROR --- DatabaseError(message='syntax error at or near "FROM"LINE 35:         FROM main_recipe_items rp_items                 ^',
                                         payload=(1,),
                                         sql='WITH passed_id AS (SELECT id AS passed_id, item_uuid as passed_uuid FROM main_items WHERE id=%s),    logistics_id AS (SELECT logistics_info_id FROM main_items WHERE id=(SELECT passed_id FROM passed_id)),    info_id AS (SELECT item_info_id FROM main_items WHERE id=(SELECT passed_id FROM passed_id)),    cte_conversions AS (        SELECT             main_conversions.id as conv_id,            main_conversions.conv_factor as conv_factor,            units.* as uom        FROM main_conversions        LEFT JOIN units ON main_conversions.uom_id = units.id        WHERE main_conversions.item_id = (SELECT passed_id FROM passed_id)    ),    cte_item_info AS (        SELECT         main_item_info.*,        row_to_json(units.*) as uom,        COALESCE((SELECT json_agg(convs) FROM cte_conversions convs), '[]'::json) AS conversions,        COALESCE((SELECT json_agg(p.*) FROM main_sku_prefix as p WHERE p.id = ANY(main_item_info.prefixes)), '[]'::json) as prefixes         FROM main_item_info        LEFT JOIN units ON main_item_info.uom = units.id        WHERE main_item_info.id = (SELECT item_info_id FROM info_id)    ),    cte_shopping_lists AS (        SELECT             main_shopping_lists.*,             main_shopping_list_items.item_type,            main_shopping_list_items.qty        FROM main_shopping_lists        JOIN main_shopping_list_items ON main_shopping_lists.list_uuid = main_shopping_list_items.list_uuid        WHERE main_shopping_list_items.item_uuid = (SELECT passed_uuid FROM passed_id)    ),    cte_recipes AS (        SELECT             rp_items.*,         FROM main_recipe_items rp_items        WHERE rp_items.item_uuid = (SELECT passed_uuid FROM passed_id)    ),    cte_itemlinks AS (        SELECT * FROM main_itemlinks WHERE link=(SELECT passed_id FROM passed_id)    ),    cte_item_locations AS (        SELECT * FROM main_item_locations        LEFT JOIN main_locations ON main_locations.id = main_item_locations.location_id        WHERE part_id = (SELECT passed_id FROM passed_id)    ),    cte_logistics_info AS (        SELECT         li.*,         row_to_json(pl) AS primary_location,        row_to_json(ail) AS auto_issue_location,        row_to_json(pz) AS primary_zone,        row_to_json(aiz) AS auto_issue_zone        FROM main_logistics_info AS li        LEFT JOIN main_locations AS pl ON li.primary_location = pl.id        LEFT JOIN main_locations AS ail ON li.auto_issue_location = ail.id        LEFT JOIN main_zones AS pz ON li.primary_zone = pz.id        LEFT JOIN main_zones AS aiz ON li.auto_issue_zone = aiz.id        WHERE li.id=(SELECT logistics_info_id FROM logistics_id)    ),    cte_barcodes AS (        SELECT         barcode.barcode As barcode,        barcode.in_exchange AS in_exchange,        barcode.out_exchange AS out_exchange,        barcode.descriptor AS descriptor        FROM main_barcodes AS barcode        LEFT JOIN main_items AS item ON item.id = (SELECT passed_id FROM passed_id)        WHERE barcode.item_uuid = item.item_uuid    )SELECT    (SELECT passed_id FROM passed_id) AS passed_id,    main_items.*,    (SELECT COALESCE(row_to_json(logis), '{}') FROM cte_logistics_info logis) AS logistics_info,    row_to_json(main_food_info.*) as food_info,     row_to_json(main_brands.*) as brand,    (SELECT COALESCE(row_to_json(ii), '{}') FROM cte_item_info ii) AS item_info,    (SELECT COALESCE(array_agg(row_to_json(sl)), '{}') FROM cte_shopping_lists sl) AS item_shopping_lists,    (SELECT COALESCE(array_agg(row_to_json(rp)), '{}') FROM cte_recipes rp) AS item_recipes,    (SELECT COALESCE(array_agg(row_to_json(il)), '{}') FROM cte_itemlinks il) AS linked_items,    (SELECT COALESCE(array_agg(row_to_json(ils)), '{}') FROM cte_item_locations ils) AS item_locations,    (SELECT COALESCE(array_agg(row_to_json(bar)), '{}') FROM cte_barcodes bar) AS item_barcodesFROM main_items    LEFT JOIN main_item_info ON main_items.item_info_id = main_item_info.id     LEFT JOIN main_food_info ON main_items.food_info_id = main_food_info.id     LEFT JOIN main_brands ON main_items.brand = main_brands.id    LEFT JOIN units ON main_item_info.uom = units.id     LEFT JOIN cte_shopping_lists ON main_items.id = cte_shopping_lists.idWHERE main_items.id=(SELECT passed_id FROM passed_id)GROUP BY     main_items.id, main_item_info.id, main_food_info.id, main_brands.id;')
2025-08-21 15:34:02.604372 --- ERROR --- DatabaseError(message='syntax error at or near "FROM"LINE 34:         FROM main_recipe_items rp_items                 ^',
                                         payload=(1,),
                                         sql='WITH passed_id AS (SELECT id AS passed_id, item_uuid as passed_uuid FROM main_items WHERE id=%s),    logistics_id AS (SELECT logistics_info_id FROM main_items WHERE id=(SELECT passed_id FROM passed_id)),    info_id AS (SELECT item_info_id FROM main_items WHERE id=(SELECT passed_id FROM passed_id)),    cte_conversions AS (        SELECT             main_conversions.id as conv_id,            main_conversions.conv_factor as conv_factor,            units.* as uom        FROM main_conversions        LEFT JOIN units ON main_conversions.uom_id = units.id        WHERE main_conversions.item_id = (SELECT passed_id FROM passed_id)    ),    cte_item_info AS (        SELECT         main_item_info.*,        row_to_json(units.*) as uom,        COALESCE((SELECT json_agg(convs) FROM cte_conversions convs), '[]'::json) AS conversions,        COALESCE((SELECT json_agg(p.*) FROM main_sku_prefix as p WHERE p.id = ANY(main_item_info.prefixes)), '[]'::json) as prefixes         FROM main_item_info        LEFT JOIN units ON main_item_info.uom = units.id        WHERE main_item_info.id = (SELECT item_info_id FROM info_id)    ),    cte_shopping_lists AS (        SELECT             main_shopping_lists.*,             main_shopping_list_items.item_type,            main_shopping_list_items.qty        FROM main_shopping_lists        JOIN main_shopping_list_items ON main_shopping_lists.list_uuid = main_shopping_list_items.list_uuid        WHERE main_shopping_list_items.item_uuid = (SELECT passed_uuid FROM passed_id)    ),    cte_recipes AS (        SELECT rp_items.*,         FROM main_recipe_items rp_items        WHERE rp_items.item_uuid = (SELECT passed_uuid FROM passed_id)    ),    cte_itemlinks AS (        SELECT * FROM main_itemlinks WHERE link=(SELECT passed_id FROM passed_id)    ),    cte_item_locations AS (        SELECT * FROM main_item_locations        LEFT JOIN main_locations ON main_locations.id = main_item_locations.location_id        WHERE part_id = (SELECT passed_id FROM passed_id)    ),    cte_logistics_info AS (        SELECT         li.*,         row_to_json(pl) AS primary_location,        row_to_json(ail) AS auto_issue_location,        row_to_json(pz) AS primary_zone,        row_to_json(aiz) AS auto_issue_zone        FROM main_logistics_info AS li        LEFT JOIN main_locations AS pl ON li.primary_location = pl.id        LEFT JOIN main_locations AS ail ON li.auto_issue_location = ail.id        LEFT JOIN main_zones AS pz ON li.primary_zone = pz.id        LEFT JOIN main_zones AS aiz ON li.auto_issue_zone = aiz.id        WHERE li.id=(SELECT logistics_info_id FROM logistics_id)    ),    cte_barcodes AS (        SELECT         barcode.barcode As barcode,        barcode.in_exchange AS in_exchange,        barcode.out_exchange AS out_exchange,        barcode.descriptor AS descriptor        FROM main_barcodes AS barcode        LEFT JOIN main_items AS item ON item.id = (SELECT passed_id FROM passed_id)        WHERE barcode.item_uuid = item.item_uuid    )SELECT    (SELECT passed_id FROM passed_id) AS passed_id,    main_items.*,    (SELECT COALESCE(row_to_json(logis), '{}') FROM cte_logistics_info logis) AS logistics_info,    row_to_json(main_food_info.*) as food_info,     row_to_json(main_brands.*) as brand,    (SELECT COALESCE(row_to_json(ii), '{}') FROM cte_item_info ii) AS item_info,    (SELECT COALESCE(array_agg(row_to_json(sl)), '{}') FROM cte_shopping_lists sl) AS item_shopping_lists,    (SELECT COALESCE(array_agg(rp), '()') FROM cte_recipes rp) AS item_recipes,    (SELECT COALESCE(array_agg(row_to_json(il)), '{}') FROM cte_itemlinks il) AS linked_items,    (SELECT COALESCE(array_agg(row_to_json(ils)), '{}') FROM cte_item_locations ils) AS item_locations,    (SELECT COALESCE(array_agg(row_to_json(bar)), '{}') FROM cte_barcodes bar) AS item_barcodesFROM main_items    LEFT JOIN main_item_info ON main_items.item_info_id = main_item_info.id     LEFT JOIN main_food_info ON main_items.food_info_id = main_food_info.id     LEFT JOIN main_brands ON main_items.brand = main_brands.id    LEFT JOIN units ON main_item_info.uom = units.id     LEFT JOIN cte_shopping_lists ON main_items.id = cte_shopping_lists.idWHERE main_items.id=(SELECT passed_id FROM passed_id)GROUP BY     main_items.id, main_item_info.id, main_food_info.id, main_brands.id;')
2025-08-21 15:34:39.473685 --- ERROR --- DatabaseError(message='syntax error at or near "FROM"LINE 34:         FROM main_recipe_items rp_items                 ^',
                                         payload=(1,),
                                         sql='WITH passed_id AS (SELECT id AS passed_id, item_uuid as passed_uuid FROM main_items WHERE id=%s),    logistics_id AS (SELECT logistics_info_id FROM main_items WHERE id=(SELECT passed_id FROM passed_id)),    info_id AS (SELECT item_info_id FROM main_items WHERE id=(SELECT passed_id FROM passed_id)),    cte_conversions AS (        SELECT             main_conversions.id as conv_id,            main_conversions.conv_factor as conv_factor,            units.* as uom        FROM main_conversions        LEFT JOIN units ON main_conversions.uom_id = units.id        WHERE main_conversions.item_id = (SELECT passed_id FROM passed_id)    ),    cte_item_info AS (        SELECT         main_item_info.*,        row_to_json(units.*) as uom,        COALESCE((SELECT json_agg(convs) FROM cte_conversions convs), '[]'::json) AS conversions,        COALESCE((SELECT json_agg(p.*) FROM main_sku_prefix as p WHERE p.id = ANY(main_item_info.prefixes)), '[]'::json) as prefixes         FROM main_item_info        LEFT JOIN units ON main_item_info.uom = units.id        WHERE main_item_info.id = (SELECT item_info_id FROM info_id)    ),    cte_shopping_lists AS (        SELECT             main_shopping_lists.*,             main_shopping_list_items.item_type,            main_shopping_list_items.qty        FROM main_shopping_lists        JOIN main_shopping_list_items ON main_shopping_lists.list_uuid = main_shopping_list_items.list_uuid        WHERE main_shopping_list_items.item_uuid = (SELECT passed_uuid FROM passed_id)    ),    cte_recipes AS (        SELECT rp_items.*,         FROM main_recipe_items rp_items        WHERE rp_items.item_uuid = (SELECT passed_uuid FROM passed_id)    ),    cte_itemlinks AS (        SELECT * FROM main_itemlinks WHERE link=(SELECT passed_id FROM passed_id)    ),    cte_item_locations AS (        SELECT * FROM main_item_locations        LEFT JOIN main_locations ON main_locations.id = main_item_locations.location_id        WHERE part_id = (SELECT passed_id FROM passed_id)    ),    cte_logistics_info AS (        SELECT         li.*,         row_to_json(pl) AS primary_location,        row_to_json(ail) AS auto_issue_location,        row_to_json(pz) AS primary_zone,        row_to_json(aiz) AS auto_issue_zone        FROM main_logistics_info AS li        LEFT JOIN main_locations AS pl ON li.primary_location = pl.id        LEFT JOIN main_locations AS ail ON li.auto_issue_location = ail.id        LEFT JOIN main_zones AS pz ON li.primary_zone = pz.id        LEFT JOIN main_zones AS aiz ON li.auto_issue_zone = aiz.id        WHERE li.id=(SELECT logistics_info_id FROM logistics_id)    ),    cte_barcodes AS (        SELECT         barcode.barcode As barcode,        barcode.in_exchange AS in_exchange,        barcode.out_exchange AS out_exchange,        barcode.descriptor AS descriptor        FROM main_barcodes AS barcode        LEFT JOIN main_items AS item ON item.id = (SELECT passed_id FROM passed_id)        WHERE barcode.item_uuid = item.item_uuid    )SELECT    (SELECT passed_id FROM passed_id) AS passed_id,    main_items.*,    (SELECT COALESCE(row_to_json(logis), '{}') FROM cte_logistics_info logis) AS logistics_info,    row_to_json(main_food_info.*) as food_info,     row_to_json(main_brands.*) as brand,    (SELECT COALESCE(row_to_json(ii), '{}') FROM cte_item_info ii) AS item_info,    (SELECT COALESCE(array_agg(row_to_json(sl)), '{}') FROM cte_shopping_lists sl) AS item_shopping_lists,    (SELECT COALESCE(array_agg(rp), '()') FROM cte_recipes rp) AS item_recipes,    (SELECT COALESCE(array_agg(row_to_json(il)), '{}') FROM cte_itemlinks il) AS linked_items,    (SELECT COALESCE(array_agg(row_to_json(ils)), '{}') FROM cte_item_locations ils) AS item_locations,    (SELECT COALESCE(array_agg(row_to_json(bar)), '{}') FROM cte_barcodes bar) AS item_barcodesFROM main_items    LEFT JOIN main_item_info ON main_items.item_info_id = main_item_info.id     LEFT JOIN main_food_info ON main_items.food_info_id = main_food_info.id     LEFT JOIN main_brands ON main_items.brand = main_brands.id    LEFT JOIN units ON main_item_info.uom = units.id     LEFT JOIN cte_shopping_lists ON main_items.id = cte_shopping_lists.idWHERE main_items.id=(SELECT passed_id FROM passed_id)GROUP BY     main_items.id, main_item_info.id, main_food_info.id, main_brands.id;')
2025-08-21 15:35:28.528730 --- ERROR --- DatabaseError(message='syntax error at or near "FROM"LINE 34:         FROM main_recipe_items rp_items                 ^',
                                         payload=(1,),
                                         sql='WITH passed_id AS (SELECT id AS passed_id, item_uuid as passed_uuid FROM main_items WHERE id=%s),    logistics_id AS (SELECT logistics_info_id FROM main_items WHERE id=(SELECT passed_id FROM passed_id)),    info_id AS (SELECT item_info_id FROM main_items WHERE id=(SELECT passed_id FROM passed_id)),    cte_conversions AS (        SELECT             main_conversions.id as conv_id,            main_conversions.conv_factor as conv_factor,            units.* as uom        FROM main_conversions        LEFT JOIN units ON main_conversions.uom_id = units.id        WHERE main_conversions.item_id = (SELECT passed_id FROM passed_id)    ),    cte_item_info AS (        SELECT         main_item_info.*,        row_to_json(units.*) as uom,        COALESCE((SELECT json_agg(convs) FROM cte_conversions convs), '[]'::json) AS conversions,        COALESCE((SELECT json_agg(p.*) FROM main_sku_prefix as p WHERE p.id = ANY(main_item_info.prefixes)), '[]'::json) as prefixes         FROM main_item_info        LEFT JOIN units ON main_item_info.uom = units.id        WHERE main_item_info.id = (SELECT item_info_id FROM info_id)    ),    cte_shopping_lists AS (        SELECT             main_shopping_lists.*,             main_shopping_list_items.item_type,            main_shopping_list_items.qty        FROM main_shopping_lists        JOIN main_shopping_list_items ON main_shopping_lists.list_uuid = main_shopping_list_items.list_uuid        WHERE main_shopping_list_items.item_uuid = (SELECT passed_uuid FROM passed_id)    ),    cte_recipes AS (        SELECT rp_items.*,         FROM main_recipe_items rp_items        WHERE rp_items.item_uuid = (SELECT passed_uuid FROM passed_id)    ),    cte_itemlinks AS (        SELECT * FROM main_itemlinks WHERE link=(SELECT passed_id FROM passed_id)    ),    cte_item_locations AS (        SELECT * FROM main_item_locations        LEFT JOIN main_locations ON main_locations.id = main_item_locations.location_id        WHERE part_id = (SELECT passed_id FROM passed_id)    ),    cte_logistics_info AS (        SELECT         li.*,         row_to_json(pl) AS primary_location,        row_to_json(ail) AS auto_issue_location,        row_to_json(pz) AS primary_zone,        row_to_json(aiz) AS auto_issue_zone        FROM main_logistics_info AS li        LEFT JOIN main_locations AS pl ON li.primary_location = pl.id        LEFT JOIN main_locations AS ail ON li.auto_issue_location = ail.id        LEFT JOIN main_zones AS pz ON li.primary_zone = pz.id        LEFT JOIN main_zones AS aiz ON li.auto_issue_zone = aiz.id        WHERE li.id=(SELECT logistics_info_id FROM logistics_id)    ),    cte_barcodes AS (        SELECT         barcode.barcode As barcode,        barcode.in_exchange AS in_exchange,        barcode.out_exchange AS out_exchange,        barcode.descriptor AS descriptor        FROM main_barcodes AS barcode        LEFT JOIN main_items AS item ON item.id = (SELECT passed_id FROM passed_id)        WHERE barcode.item_uuid = item.item_uuid    )SELECT    (SELECT passed_id FROM passed_id) AS passed_id,    main_items.*,    (SELECT COALESCE(row_to_json(logis), '{}') FROM cte_logistics_info logis) AS logistics_info,    row_to_json(main_food_info.*) as food_info,     row_to_json(main_brands.*) as brand,    (SELECT COALESCE(row_to_json(ii), '{}') FROM cte_item_info ii) AS item_info,    (SELECT COALESCE(array_agg(row_to_json(sl)), '{}') FROM cte_shopping_lists sl) AS item_shopping_lists,    (SELECT COALESCE(array_agg(rp), '()') FROM cte_recipes rp) AS item_recipes,    (SELECT COALESCE(array_agg(row_to_json(il)), '{}') FROM cte_itemlinks il) AS linked_items,    (SELECT COALESCE(array_agg(row_to_json(ils)), '{}') FROM cte_item_locations ils) AS item_locations,    (SELECT COALESCE(array_agg(row_to_json(bar)), '{}') FROM cte_barcodes bar) AS item_barcodesFROM main_items    LEFT JOIN main_item_info ON main_items.item_info_id = main_item_info.id     LEFT JOIN main_food_info ON main_items.food_info_id = main_food_info.id     LEFT JOIN main_brands ON main_items.brand = main_brands.id    LEFT JOIN units ON main_item_info.uom = units.id     LEFT JOIN cte_shopping_lists ON main_items.id = cte_shopping_lists.idWHERE main_items.id=(SELECT passed_id FROM passed_id)GROUP BY     main_items.id, main_item_info.id, main_food_info.id, main_brands.id;')
2025-08-21 15:35:54.588258 --- ERROR --- DatabaseError(message='syntax error at or near "FROM"LINE 34:         FROM main_recipe_items rp_items                 ^',
                                         payload=(1,),
                                         sql='WITH passed_id AS (SELECT id AS passed_id, item_uuid as passed_uuid FROM main_items WHERE id=%s),    logistics_id AS (SELECT logistics_info_id FROM main_items WHERE id=(SELECT passed_id FROM passed_id)),    info_id AS (SELECT item_info_id FROM main_items WHERE id=(SELECT passed_id FROM passed_id)),    cte_conversions AS (        SELECT             main_conversions.id as conv_id,            main_conversions.conv_factor as conv_factor,            units.* as uom        FROM main_conversions        LEFT JOIN units ON main_conversions.uom_id = units.id        WHERE main_conversions.item_id = (SELECT passed_id FROM passed_id)    ),    cte_item_info AS (        SELECT         main_item_info.*,        row_to_json(units.*) as uom,        COALESCE((SELECT json_agg(convs) FROM cte_conversions convs), '[]'::json) AS conversions,        COALESCE((SELECT json_agg(p.*) FROM main_sku_prefix as p WHERE p.id = ANY(main_item_info.prefixes)), '[]'::json) as prefixes         FROM main_item_info        LEFT JOIN units ON main_item_info.uom = units.id        WHERE main_item_info.id = (SELECT item_info_id FROM info_id)    ),    cte_shopping_lists AS (        SELECT             main_shopping_lists.*,             main_shopping_list_items.item_type,            main_shopping_list_items.qty        FROM main_shopping_lists        JOIN main_shopping_list_items ON main_shopping_lists.list_uuid = main_shopping_list_items.list_uuid        WHERE main_shopping_list_items.item_uuid = (SELECT passed_uuid FROM passed_id)    ),    cte_recipes AS (        SELECT rp_items.*,         FROM main_recipe_items rp_items        WHERE rp_items.item_uuid = (SELECT passed_uuid FROM passed_id)    ),    cte_itemlinks AS (        SELECT * FROM main_itemlinks WHERE link=(SELECT passed_id FROM passed_id)    ),    cte_item_locations AS (        SELECT * FROM main_item_locations        LEFT JOIN main_locations ON main_locations.id = main_item_locations.location_id        WHERE part_id = (SELECT passed_id FROM passed_id)    ),    cte_logistics_info AS (        SELECT         li.*,         row_to_json(pl) AS primary_location,        row_to_json(ail) AS auto_issue_location,        row_to_json(pz) AS primary_zone,        row_to_json(aiz) AS auto_issue_zone        FROM main_logistics_info AS li        LEFT JOIN main_locations AS pl ON li.primary_location = pl.id        LEFT JOIN main_locations AS ail ON li.auto_issue_location = ail.id        LEFT JOIN main_zones AS pz ON li.primary_zone = pz.id        LEFT JOIN main_zones AS aiz ON li.auto_issue_zone = aiz.id        WHERE li.id=(SELECT logistics_info_id FROM logistics_id)    ),    cte_barcodes AS (        SELECT         barcode.barcode As barcode,        barcode.in_exchange AS in_exchange,        barcode.out_exchange AS out_exchange,        barcode.descriptor AS descriptor        FROM main_barcodes AS barcode        LEFT JOIN main_items AS item ON item.id = (SELECT passed_id FROM passed_id)        WHERE barcode.item_uuid = item.item_uuid    )SELECT    (SELECT passed_id FROM passed_id) AS passed_id,    main_items.*,    (SELECT COALESCE(row_to_json(logis), '{}') FROM cte_logistics_info logis) AS logistics_info,    row_to_json(main_food_info.*) as food_info,     row_to_json(main_brands.*) as brand,    (SELECT COALESCE(row_to_json(ii), '{}') FROM cte_item_info ii) AS item_info,    (SELECT COALESCE(array_agg(row_to_json(sl)), '{}') FROM cte_shopping_lists sl) AS item_shopping_lists,        (SELECT COALESCE(array_agg(row_to_json(il)), '{}') FROM cte_itemlinks il) AS linked_items,    (SELECT COALESCE(array_agg(row_to_json(ils)), '{}') FROM cte_item_locations ils) AS item_locations,    (SELECT COALESCE(array_agg(row_to_json(bar)), '{}') FROM cte_barcodes bar) AS item_barcodesFROM main_items    LEFT JOIN main_item_info ON main_items.item_info_id = main_item_info.id     LEFT JOIN main_food_info ON main_items.food_info_id = main_food_info.id     LEFT JOIN main_brands ON main_items.brand = main_brands.id    LEFT JOIN units ON main_item_info.uom = units.id     LEFT JOIN cte_shopping_lists ON main_items.id = cte_shopping_lists.idWHERE main_items.id=(SELECT passed_id FROM passed_id)GROUP BY     main_items.id, main_item_info.id, main_food_info.id, main_brands.id;')
2025-08-21 15:37:16.582148 --- ERROR --- DatabaseError(message='malformed array literal: "()"LINE 78:     (SELECT COALESCE(array_agg(rp), '()') FROM cte_recipes r...                                             ^DETAIL:  Array value must start with "{" or dimension information.',
                                         payload=(1,),
                                         sql='WITH passed_id AS (SELECT id AS passed_id, item_uuid as passed_uuid FROM main_items WHERE id=%s),    logistics_id AS (SELECT logistics_info_id FROM main_items WHERE id=(SELECT passed_id FROM passed_id)),    info_id AS (SELECT item_info_id FROM main_items WHERE id=(SELECT passed_id FROM passed_id)),    cte_conversions AS (        SELECT             main_conversions.id as conv_id,            main_conversions.conv_factor as conv_factor,            units.* as uom        FROM main_conversions        LEFT JOIN units ON main_conversions.uom_id = units.id        WHERE main_conversions.item_id = (SELECT passed_id FROM passed_id)    ),    cte_item_info AS (        SELECT         main_item_info.*,        row_to_json(units.*) as uom,        COALESCE((SELECT json_agg(convs) FROM cte_conversions convs), '[]'::json) AS conversions,        COALESCE((SELECT json_agg(p.*) FROM main_sku_prefix as p WHERE p.id = ANY(main_item_info.prefixes)), '[]'::json) as prefixes         FROM main_item_info        LEFT JOIN units ON main_item_info.uom = units.id        WHERE main_item_info.id = (SELECT item_info_id FROM info_id)    ),    cte_shopping_lists AS (        SELECT             main_shopping_lists.*,             main_shopping_list_items.item_type,            main_shopping_list_items.qty        FROM main_shopping_lists        JOIN main_shopping_list_items ON main_shopping_lists.list_uuid = main_shopping_list_items.list_uuid        WHERE main_shopping_list_items.item_uuid = (SELECT passed_uuid FROM passed_id)    ),    cte_recipes AS (        SELECT rp_items.*         FROM main_recipe_items rp_items        WHERE rp_items.item_uuid = (SELECT passed_uuid FROM passed_id)    ),    cte_itemlinks AS (        SELECT * FROM main_itemlinks WHERE link=(SELECT passed_id FROM passed_id)    ),    cte_item_locations AS (        SELECT * FROM main_item_locations        LEFT JOIN main_locations ON main_locations.id = main_item_locations.location_id        WHERE part_id = (SELECT passed_id FROM passed_id)    ),    cte_logistics_info AS (        SELECT         li.*,         row_to_json(pl) AS primary_location,        row_to_json(ail) AS auto_issue_location,        row_to_json(pz) AS primary_zone,        row_to_json(aiz) AS auto_issue_zone        FROM main_logistics_info AS li        LEFT JOIN main_locations AS pl ON li.primary_location = pl.id        LEFT JOIN main_locations AS ail ON li.auto_issue_location = ail.id        LEFT JOIN main_zones AS pz ON li.primary_zone = pz.id        LEFT JOIN main_zones AS aiz ON li.auto_issue_zone = aiz.id        WHERE li.id=(SELECT logistics_info_id FROM logistics_id)    ),    cte_barcodes AS (        SELECT         barcode.barcode As barcode,        barcode.in_exchange AS in_exchange,        barcode.out_exchange AS out_exchange,        barcode.descriptor AS descriptor        FROM main_barcodes AS barcode        LEFT JOIN main_items AS item ON item.id = (SELECT passed_id FROM passed_id)        WHERE barcode.item_uuid = item.item_uuid    )SELECT    (SELECT passed_id FROM passed_id) AS passed_id,    main_items.*,    (SELECT COALESCE(row_to_json(logis), '{}') FROM cte_logistics_info logis) AS logistics_info,    row_to_json(main_food_info.*) as food_info,     row_to_json(main_brands.*) as brand,    (SELECT COALESCE(row_to_json(ii), '{}') FROM cte_item_info ii) AS item_info,    (SELECT COALESCE(array_agg(row_to_json(sl)), '{}') FROM cte_shopping_lists sl) AS item_shopping_lists,    (SELECT COALESCE(array_agg(rp), '()') FROM cte_recipes rp) AS item_recipes,    (SELECT COALESCE(array_agg(row_to_json(il)), '{}') FROM cte_itemlinks il) AS linked_items,    (SELECT COALESCE(array_agg(row_to_json(ils)), '{}') FROM cte_item_locations ils) AS item_locations,    (SELECT COALESCE(array_agg(row_to_json(bar)), '{}') FROM cte_barcodes bar) AS item_barcodesFROM main_items    LEFT JOIN main_item_info ON main_items.item_info_id = main_item_info.id     LEFT JOIN main_food_info ON main_items.food_info_id = main_food_info.id     LEFT JOIN main_brands ON main_items.brand = main_brands.id    LEFT JOIN units ON main_item_info.uom = units.id     LEFT JOIN cte_shopping_lists ON main_items.id = cte_shopping_lists.idWHERE main_items.id=(SELECT passed_id FROM passed_id)GROUP BY     main_items.id, main_item_info.id, main_food_info.id, main_brands.id;')
2025-08-21 15:38:10.175186 --- ERROR --- DatabaseError(message='subquery must return only one columnLINE 78:     (SELECT * FROM cte_recipes AS item_recipes),             ^',
                                         payload=(1,),
                                         sql='WITH passed_id AS (SELECT id AS passed_id, item_uuid as passed_uuid FROM main_items WHERE id=%s),    logistics_id AS (SELECT logistics_info_id FROM main_items WHERE id=(SELECT passed_id FROM passed_id)),    info_id AS (SELECT item_info_id FROM main_items WHERE id=(SELECT passed_id FROM passed_id)),    cte_conversions AS (        SELECT             main_conversions.id as conv_id,            main_conversions.conv_factor as conv_factor,            units.* as uom        FROM main_conversions        LEFT JOIN units ON main_conversions.uom_id = units.id        WHERE main_conversions.item_id = (SELECT passed_id FROM passed_id)    ),    cte_item_info AS (        SELECT         main_item_info.*,        row_to_json(units.*) as uom,        COALESCE((SELECT json_agg(convs) FROM cte_conversions convs), '[]'::json) AS conversions,        COALESCE((SELECT json_agg(p.*) FROM main_sku_prefix as p WHERE p.id = ANY(main_item_info.prefixes)), '[]'::json) as prefixes         FROM main_item_info        LEFT JOIN units ON main_item_info.uom = units.id        WHERE main_item_info.id = (SELECT item_info_id FROM info_id)    ),    cte_shopping_lists AS (        SELECT             main_shopping_lists.*,             main_shopping_list_items.item_type,            main_shopping_list_items.qty        FROM main_shopping_lists        JOIN main_shopping_list_items ON main_shopping_lists.list_uuid = main_shopping_list_items.list_uuid        WHERE main_shopping_list_items.item_uuid = (SELECT passed_uuid FROM passed_id)    ),    cte_recipes AS (        SELECT rp_items.*        FROM main_recipe_items rp_items        WHERE rp_items.item_uuid = (SELECT passed_uuid FROM passed_id)    ),    cte_itemlinks AS (        SELECT * FROM main_itemlinks WHERE link=(SELECT passed_id FROM passed_id)    ),    cte_item_locations AS (        SELECT * FROM main_item_locations        LEFT JOIN main_locations ON main_locations.id = main_item_locations.location_id        WHERE part_id = (SELECT passed_id FROM passed_id)    ),    cte_logistics_info AS (        SELECT         li.*,         row_to_json(pl) AS primary_location,        row_to_json(ail) AS auto_issue_location,        row_to_json(pz) AS primary_zone,        row_to_json(aiz) AS auto_issue_zone        FROM main_logistics_info AS li        LEFT JOIN main_locations AS pl ON li.primary_location = pl.id        LEFT JOIN main_locations AS ail ON li.auto_issue_location = ail.id        LEFT JOIN main_zones AS pz ON li.primary_zone = pz.id        LEFT JOIN main_zones AS aiz ON li.auto_issue_zone = aiz.id        WHERE li.id=(SELECT logistics_info_id FROM logistics_id)    ),    cte_barcodes AS (        SELECT         barcode.barcode As barcode,        barcode.in_exchange AS in_exchange,        barcode.out_exchange AS out_exchange,        barcode.descriptor AS descriptor        FROM main_barcodes AS barcode        LEFT JOIN main_items AS item ON item.id = (SELECT passed_id FROM passed_id)        WHERE barcode.item_uuid = item.item_uuid    )SELECT    (SELECT passed_id FROM passed_id) AS passed_id,    main_items.*,    (SELECT COALESCE(row_to_json(logis), '{}') FROM cte_logistics_info logis) AS logistics_info,    row_to_json(main_food_info.*) as food_info,     row_to_json(main_brands.*) as brand,    (SELECT COALESCE(row_to_json(ii), '{}') FROM cte_item_info ii) AS item_info,    (SELECT COALESCE(array_agg(row_to_json(sl)), '{}') FROM cte_shopping_lists sl) AS item_shopping_lists,    (SELECT * FROM cte_recipes AS item_recipes),    (SELECT COALESCE(array_agg(row_to_json(il)), '{}') FROM cte_itemlinks il) AS linked_items,    (SELECT COALESCE(array_agg(row_to_json(ils)), '{}') FROM cte_item_locations ils) AS item_locations,    (SELECT COALESCE(array_agg(row_to_json(bar)), '{}') FROM cte_barcodes bar) AS item_barcodesFROM main_items    LEFT JOIN main_item_info ON main_items.item_info_id = main_item_info.id     LEFT JOIN main_food_info ON main_items.food_info_id = main_food_info.id     LEFT JOIN main_brands ON main_items.brand = main_brands.id    LEFT JOIN units ON main_item_info.uom = units.id     LEFT JOIN cte_shopping_lists ON main_items.id = cte_shopping_lists.idWHERE main_items.id=(SELECT passed_id FROM passed_id)GROUP BY     main_items.id, main_item_info.id, main_food_info.id, main_brands.id;')
2025-08-21 15:38:23.981975 --- ERROR --- DatabaseError(message='subquery must return only one columnLINE 78:     (SELECT * FROM cte_recipes) as item_recipes,             ^',
                                         payload=(1,),
                                         sql='WITH passed_id AS (SELECT id AS passed_id, item_uuid as passed_uuid FROM main_items WHERE id=%s),    logistics_id AS (SELECT logistics_info_id FROM main_items WHERE id=(SELECT passed_id FROM passed_id)),    info_id AS (SELECT item_info_id FROM main_items WHERE id=(SELECT passed_id FROM passed_id)),    cte_conversions AS (        SELECT             main_conversions.id as conv_id,            main_conversions.conv_factor as conv_factor,            units.* as uom        FROM main_conversions        LEFT JOIN units ON main_conversions.uom_id = units.id        WHERE main_conversions.item_id = (SELECT passed_id FROM passed_id)    ),    cte_item_info AS (        SELECT         main_item_info.*,        row_to_json(units.*) as uom,        COALESCE((SELECT json_agg(convs) FROM cte_conversions convs), '[]'::json) AS conversions,        COALESCE((SELECT json_agg(p.*) FROM main_sku_prefix as p WHERE p.id = ANY(main_item_info.prefixes)), '[]'::json) as prefixes         FROM main_item_info        LEFT JOIN units ON main_item_info.uom = units.id        WHERE main_item_info.id = (SELECT item_info_id FROM info_id)    ),    cte_shopping_lists AS (        SELECT             main_shopping_lists.*,             main_shopping_list_items.item_type,            main_shopping_list_items.qty        FROM main_shopping_lists        JOIN main_shopping_list_items ON main_shopping_lists.list_uuid = main_shopping_list_items.list_uuid        WHERE main_shopping_list_items.item_uuid = (SELECT passed_uuid FROM passed_id)    ),    cte_recipes AS (        SELECT rp_items.*        FROM main_recipe_items rp_items        WHERE rp_items.item_uuid = (SELECT passed_uuid FROM passed_id)    ),    cte_itemlinks AS (        SELECT * FROM main_itemlinks WHERE link=(SELECT passed_id FROM passed_id)    ),    cte_item_locations AS (        SELECT * FROM main_item_locations        LEFT JOIN main_locations ON main_locations.id = main_item_locations.location_id        WHERE part_id = (SELECT passed_id FROM passed_id)    ),    cte_logistics_info AS (        SELECT         li.*,         row_to_json(pl) AS primary_location,        row_to_json(ail) AS auto_issue_location,        row_to_json(pz) AS primary_zone,        row_to_json(aiz) AS auto_issue_zone        FROM main_logistics_info AS li        LEFT JOIN main_locations AS pl ON li.primary_location = pl.id        LEFT JOIN main_locations AS ail ON li.auto_issue_location = ail.id        LEFT JOIN main_zones AS pz ON li.primary_zone = pz.id        LEFT JOIN main_zones AS aiz ON li.auto_issue_zone = aiz.id        WHERE li.id=(SELECT logistics_info_id FROM logistics_id)    ),    cte_barcodes AS (        SELECT         barcode.barcode As barcode,        barcode.in_exchange AS in_exchange,        barcode.out_exchange AS out_exchange,        barcode.descriptor AS descriptor        FROM main_barcodes AS barcode        LEFT JOIN main_items AS item ON item.id = (SELECT passed_id FROM passed_id)        WHERE barcode.item_uuid = item.item_uuid    )SELECT    (SELECT passed_id FROM passed_id) AS passed_id,    main_items.*,    (SELECT COALESCE(row_to_json(logis), '{}') FROM cte_logistics_info logis) AS logistics_info,    row_to_json(main_food_info.*) as food_info,     row_to_json(main_brands.*) as brand,    (SELECT COALESCE(row_to_json(ii), '{}') FROM cte_item_info ii) AS item_info,    (SELECT COALESCE(array_agg(row_to_json(sl)), '{}') FROM cte_shopping_lists sl) AS item_shopping_lists,    (SELECT * FROM cte_recipes) as item_recipes,    (SELECT COALESCE(array_agg(row_to_json(il)), '{}') FROM cte_itemlinks il) AS linked_items,    (SELECT COALESCE(array_agg(row_to_json(ils)), '{}') FROM cte_item_locations ils) AS item_locations,    (SELECT COALESCE(array_agg(row_to_json(bar)), '{}') FROM cte_barcodes bar) AS item_barcodesFROM main_items    LEFT JOIN main_item_info ON main_items.item_info_id = main_item_info.id     LEFT JOIN main_food_info ON main_items.food_info_id = main_food_info.id     LEFT JOIN main_brands ON main_items.brand = main_brands.id    LEFT JOIN units ON main_item_info.uom = units.id     LEFT JOIN cte_shopping_lists ON main_items.id = cte_shopping_lists.idWHERE main_items.id=(SELECT passed_id FROM passed_id)GROUP BY     main_items.id, main_item_info.id, main_food_info.id, main_brands.id;')
2025-08-21 15:38:50.106138 --- ERROR --- DatabaseError(message='syntax error at or near "*"LINE 78:     (SELECT COALESCE(*, '()') FROM cte_recipes) as item_reci...                              ^',
                                         payload=(1,),
                                         sql='WITH passed_id AS (SELECT id AS passed_id, item_uuid as passed_uuid FROM main_items WHERE id=%s),    logistics_id AS (SELECT logistics_info_id FROM main_items WHERE id=(SELECT passed_id FROM passed_id)),    info_id AS (SELECT item_info_id FROM main_items WHERE id=(SELECT passed_id FROM passed_id)),    cte_conversions AS (        SELECT             main_conversions.id as conv_id,            main_conversions.conv_factor as conv_factor,            units.* as uom        FROM main_conversions        LEFT JOIN units ON main_conversions.uom_id = units.id        WHERE main_conversions.item_id = (SELECT passed_id FROM passed_id)    ),    cte_item_info AS (        SELECT         main_item_info.*,        row_to_json(units.*) as uom,        COALESCE((SELECT json_agg(convs) FROM cte_conversions convs), '[]'::json) AS conversions,        COALESCE((SELECT json_agg(p.*) FROM main_sku_prefix as p WHERE p.id = ANY(main_item_info.prefixes)), '[]'::json) as prefixes         FROM main_item_info        LEFT JOIN units ON main_item_info.uom = units.id        WHERE main_item_info.id = (SELECT item_info_id FROM info_id)    ),    cte_shopping_lists AS (        SELECT             main_shopping_lists.*,             main_shopping_list_items.item_type,            main_shopping_list_items.qty        FROM main_shopping_lists        JOIN main_shopping_list_items ON main_shopping_lists.list_uuid = main_shopping_list_items.list_uuid        WHERE main_shopping_list_items.item_uuid = (SELECT passed_uuid FROM passed_id)    ),    cte_recipes AS (        SELECT rp_items.*        FROM main_recipe_items rp_items        WHERE rp_items.item_uuid = (SELECT passed_uuid FROM passed_id)    ),    cte_itemlinks AS (        SELECT * FROM main_itemlinks WHERE link=(SELECT passed_id FROM passed_id)    ),    cte_item_locations AS (        SELECT * FROM main_item_locations        LEFT JOIN main_locations ON main_locations.id = main_item_locations.location_id        WHERE part_id = (SELECT passed_id FROM passed_id)    ),    cte_logistics_info AS (        SELECT         li.*,         row_to_json(pl) AS primary_location,        row_to_json(ail) AS auto_issue_location,        row_to_json(pz) AS primary_zone,        row_to_json(aiz) AS auto_issue_zone        FROM main_logistics_info AS li        LEFT JOIN main_locations AS pl ON li.primary_location = pl.id        LEFT JOIN main_locations AS ail ON li.auto_issue_location = ail.id        LEFT JOIN main_zones AS pz ON li.primary_zone = pz.id        LEFT JOIN main_zones AS aiz ON li.auto_issue_zone = aiz.id        WHERE li.id=(SELECT logistics_info_id FROM logistics_id)    ),    cte_barcodes AS (        SELECT         barcode.barcode As barcode,        barcode.in_exchange AS in_exchange,        barcode.out_exchange AS out_exchange,        barcode.descriptor AS descriptor        FROM main_barcodes AS barcode        LEFT JOIN main_items AS item ON item.id = (SELECT passed_id FROM passed_id)        WHERE barcode.item_uuid = item.item_uuid    )SELECT    (SELECT passed_id FROM passed_id) AS passed_id,    main_items.*,    (SELECT COALESCE(row_to_json(logis), '{}') FROM cte_logistics_info logis) AS logistics_info,    row_to_json(main_food_info.*) as food_info,     row_to_json(main_brands.*) as brand,    (SELECT COALESCE(row_to_json(ii), '{}') FROM cte_item_info ii) AS item_info,    (SELECT COALESCE(array_agg(row_to_json(sl)), '{}') FROM cte_shopping_lists sl) AS item_shopping_lists,    (SELECT COALESCE(*, '()') FROM cte_recipes) as item_recipes,    (SELECT COALESCE(array_agg(row_to_json(il)), '{}') FROM cte_itemlinks il) AS linked_items,    (SELECT COALESCE(array_agg(row_to_json(ils)), '{}') FROM cte_item_locations ils) AS item_locations,    (SELECT COALESCE(array_agg(row_to_json(bar)), '{}') FROM cte_barcodes bar) AS item_barcodesFROM main_items    LEFT JOIN main_item_info ON main_items.item_info_id = main_item_info.id     LEFT JOIN main_food_info ON main_items.food_info_id = main_food_info.id     LEFT JOIN main_brands ON main_items.brand = main_brands.id    LEFT JOIN units ON main_item_info.uom = units.id     LEFT JOIN cte_shopping_lists ON main_items.id = cte_shopping_lists.idWHERE main_items.id=(SELECT passed_id FROM passed_id)GROUP BY     main_items.id, main_item_info.id, main_food_info.id, main_brands.id;')
2025-08-21 15:39:05.980541 --- ERROR --- DatabaseError(message='input of anonymous composite types is not implementedLINE 78:     (SELECT COALESCE(cte_recipes.*, '()') FROM cte_recipes) ...                                             ^',
                                         payload=(1,),
                                         sql='WITH passed_id AS (SELECT id AS passed_id, item_uuid as passed_uuid FROM main_items WHERE id=%s),    logistics_id AS (SELECT logistics_info_id FROM main_items WHERE id=(SELECT passed_id FROM passed_id)),    info_id AS (SELECT item_info_id FROM main_items WHERE id=(SELECT passed_id FROM passed_id)),    cte_conversions AS (        SELECT             main_conversions.id as conv_id,            main_conversions.conv_factor as conv_factor,            units.* as uom        FROM main_conversions        LEFT JOIN units ON main_conversions.uom_id = units.id        WHERE main_conversions.item_id = (SELECT passed_id FROM passed_id)    ),    cte_item_info AS (        SELECT         main_item_info.*,        row_to_json(units.*) as uom,        COALESCE((SELECT json_agg(convs) FROM cte_conversions convs), '[]'::json) AS conversions,        COALESCE((SELECT json_agg(p.*) FROM main_sku_prefix as p WHERE p.id = ANY(main_item_info.prefixes)), '[]'::json) as prefixes         FROM main_item_info        LEFT JOIN units ON main_item_info.uom = units.id        WHERE main_item_info.id = (SELECT item_info_id FROM info_id)    ),    cte_shopping_lists AS (        SELECT             main_shopping_lists.*,             main_shopping_list_items.item_type,            main_shopping_list_items.qty        FROM main_shopping_lists        JOIN main_shopping_list_items ON main_shopping_lists.list_uuid = main_shopping_list_items.list_uuid        WHERE main_shopping_list_items.item_uuid = (SELECT passed_uuid FROM passed_id)    ),    cte_recipes AS (        SELECT rp_items.*        FROM main_recipe_items rp_items        WHERE rp_items.item_uuid = (SELECT passed_uuid FROM passed_id)    ),    cte_itemlinks AS (        SELECT * FROM main_itemlinks WHERE link=(SELECT passed_id FROM passed_id)    ),    cte_item_locations AS (        SELECT * FROM main_item_locations        LEFT JOIN main_locations ON main_locations.id = main_item_locations.location_id        WHERE part_id = (SELECT passed_id FROM passed_id)    ),    cte_logistics_info AS (        SELECT         li.*,         row_to_json(pl) AS primary_location,        row_to_json(ail) AS auto_issue_location,        row_to_json(pz) AS primary_zone,        row_to_json(aiz) AS auto_issue_zone        FROM main_logistics_info AS li        LEFT JOIN main_locations AS pl ON li.primary_location = pl.id        LEFT JOIN main_locations AS ail ON li.auto_issue_location = ail.id        LEFT JOIN main_zones AS pz ON li.primary_zone = pz.id        LEFT JOIN main_zones AS aiz ON li.auto_issue_zone = aiz.id        WHERE li.id=(SELECT logistics_info_id FROM logistics_id)    ),    cte_barcodes AS (        SELECT         barcode.barcode As barcode,        barcode.in_exchange AS in_exchange,        barcode.out_exchange AS out_exchange,        barcode.descriptor AS descriptor        FROM main_barcodes AS barcode        LEFT JOIN main_items AS item ON item.id = (SELECT passed_id FROM passed_id)        WHERE barcode.item_uuid = item.item_uuid    )SELECT    (SELECT passed_id FROM passed_id) AS passed_id,    main_items.*,    (SELECT COALESCE(row_to_json(logis), '{}') FROM cte_logistics_info logis) AS logistics_info,    row_to_json(main_food_info.*) as food_info,     row_to_json(main_brands.*) as brand,    (SELECT COALESCE(row_to_json(ii), '{}') FROM cte_item_info ii) AS item_info,    (SELECT COALESCE(array_agg(row_to_json(sl)), '{}') FROM cte_shopping_lists sl) AS item_shopping_lists,    (SELECT COALESCE(cte_recipes.*, '()') FROM cte_recipes) as item_recipes,    (SELECT COALESCE(array_agg(row_to_json(il)), '{}') FROM cte_itemlinks il) AS linked_items,    (SELECT COALESCE(array_agg(row_to_json(ils)), '{}') FROM cte_item_locations ils) AS item_locations,    (SELECT COALESCE(array_agg(row_to_json(bar)), '{}') FROM cte_barcodes bar) AS item_barcodesFROM main_items    LEFT JOIN main_item_info ON main_items.item_info_id = main_item_info.id     LEFT JOIN main_food_info ON main_items.food_info_id = main_food_info.id     LEFT JOIN main_brands ON main_items.brand = main_brands.id    LEFT JOIN units ON main_item_info.uom = units.id     LEFT JOIN cte_shopping_lists ON main_items.id = cte_shopping_lists.idWHERE main_items.id=(SELECT passed_id FROM passed_id)GROUP BY     main_items.id, main_item_info.id, main_food_info.id, main_brands.id;')
2025-08-21 15:58:14.461388 --- ERROR --- DatabaseError(message='input of anonymous composite types is not implementedLINE 78:     (SELECT COALESCE(cte_recipes.*, '()') FROM cte_recipes) ...                                             ^',
                                         payload=(1,),
                                         sql='WITH passed_id AS (SELECT id AS passed_id, item_uuid as passed_uuid FROM main_items WHERE id=%s),    logistics_id AS (SELECT logistics_info_id FROM main_items WHERE id=(SELECT passed_id FROM passed_id)),    info_id AS (SELECT item_info_id FROM main_items WHERE id=(SELECT passed_id FROM passed_id)),    cte_conversions AS (        SELECT             main_conversions.id as conv_id,            main_conversions.conv_factor as conv_factor,            units.* as uom        FROM main_conversions        LEFT JOIN units ON main_conversions.uom_id = units.id        WHERE main_conversions.item_id = (SELECT passed_id FROM passed_id)    ),    cte_item_info AS (        SELECT         main_item_info.*,        row_to_json(units.*) as uom,        COALESCE((SELECT json_agg(convs) FROM cte_conversions convs), '[]'::json) AS conversions,        COALESCE((SELECT json_agg(p.*) FROM main_sku_prefix as p WHERE p.id = ANY(main_item_info.prefixes)), '[]'::json) as prefixes         FROM main_item_info        LEFT JOIN units ON main_item_info.uom = units.id        WHERE main_item_info.id = (SELECT item_info_id FROM info_id)    ),    cte_shopping_lists AS (        SELECT             main_shopping_lists.*,             main_shopping_list_items.item_type,            main_shopping_list_items.qty        FROM main_shopping_lists        JOIN main_shopping_list_items ON main_shopping_lists.list_uuid = main_shopping_list_items.list_uuid        WHERE main_shopping_list_items.item_uuid = (SELECT passed_uuid FROM passed_id)    ),    cte_recipes AS (        SELECT rp_items.*        FROM main_recipe_items rp_items        WHERE rp_items.item_uuid = (SELECT passed_uuid FROM passed_id)    ),    cte_itemlinks AS (        SELECT * FROM main_itemlinks WHERE link=(SELECT passed_id FROM passed_id)    ),    cte_item_locations AS (        SELECT * FROM main_item_locations        LEFT JOIN main_locations ON main_locations.id = main_item_locations.location_id        WHERE part_id = (SELECT passed_id FROM passed_id)    ),    cte_logistics_info AS (        SELECT         li.*,         row_to_json(pl) AS primary_location,        row_to_json(ail) AS auto_issue_location,        row_to_json(pz) AS primary_zone,        row_to_json(aiz) AS auto_issue_zone        FROM main_logistics_info AS li        LEFT JOIN main_locations AS pl ON li.primary_location = pl.id        LEFT JOIN main_locations AS ail ON li.auto_issue_location = ail.id        LEFT JOIN main_zones AS pz ON li.primary_zone = pz.id        LEFT JOIN main_zones AS aiz ON li.auto_issue_zone = aiz.id        WHERE li.id=(SELECT logistics_info_id FROM logistics_id)    ),    cte_barcodes AS (        SELECT         barcode.barcode As barcode,        barcode.in_exchange AS in_exchange,        barcode.out_exchange AS out_exchange,        barcode.descriptor AS descriptor        FROM main_barcodes AS barcode        LEFT JOIN main_items AS item ON item.id = (SELECT passed_id FROM passed_id)        WHERE barcode.item_uuid = item.item_uuid    )SELECT    (SELECT passed_id FROM passed_id) AS passed_id,    main_items.*,    (SELECT COALESCE(row_to_json(logis), '{}') FROM cte_logistics_info logis) AS logistics_info,    row_to_json(main_food_info.*) as food_info,     row_to_json(main_brands.*) as brand,    (SELECT COALESCE(row_to_json(ii), '{}') FROM cte_item_info ii) AS item_info,    (SELECT COALESCE(array_agg(row_to_json(sl)), '{}') FROM cte_shopping_lists sl) AS item_shopping_lists,    (SELECT COALESCE(cte_recipes.*, '()') FROM cte_recipes) as item_recipes,    (SELECT COALESCE(array_agg(row_to_json(il)), '{}') FROM cte_itemlinks il) AS linked_items,    (SELECT COALESCE(array_agg(row_to_json(ils)), '{}') FROM cte_item_locations ils) AS item_locations,    (SELECT COALESCE(array_agg(row_to_json(bar)), '{}') FROM cte_barcodes bar) AS item_barcodesFROM main_items    LEFT JOIN main_item_info ON main_items.item_info_id = main_item_info.id     LEFT JOIN main_food_info ON main_items.food_info_id = main_food_info.id     LEFT JOIN main_brands ON main_items.brand = main_brands.id    LEFT JOIN units ON main_item_info.uom = units.id     LEFT JOIN cte_shopping_lists ON main_items.id = cte_shopping_lists.idWHERE main_items.id=(SELECT passed_id FROM passed_id)GROUP BY     main_items.id, main_item_info.id, main_food_info.id, main_brands.id;')
2025-08-21 17:10:08.203762 --- ERROR --- DatabaseError(message='duplicate key value violates unique constraint "main_barcodes_pkey"DETAIL:  Key (barcode)=(%085239099810%) already exists.',
                                         payload=('%085239099810%', '6ff93491-ede3-4f90-aca3-8617ab057617', '1', '1', ''),
                                         sql='INSERT INTO main_barcodes (barcode, item_uuid, in_exchange, out_exchange, descriptor) VALUES (%s, %s, %s, %s, %s) RETURNING *;')
2025-08-21 17:32:04.748621 --- ERROR --- DatabaseError(message='syntax error at or near "%"LINE 1: SELECT COUNT(*) FROM main_items items LEFT JOIN %site_name%_...                                                        ^',
                                         payload=('', 25, 0),
                                         sql='SELECT items.item_uuid as item_uuid,    items.item_name as item_name,    units.fullname AS fullname,    units.id AS unit_id,    items.links AS linksFROM main_items itemsLEFT JOIN main_item_info item_info ON item_info.id = items.item_info_idLEFT JOIN units ON item_info.uom = units.idWHERE items.search_string LIKE '%%' || %s || '%%'    AND items.inactive IS false    AND item_info.safety_stock > 0ORDER BY items.item_name LIMIT %s OFFSET %s;')
2025-08-21 17:32:19.598403 --- ERROR --- DatabaseError(message='syntax error at or near "%"LINE 1: ...CT COUNT(items.*) FROM main_items items LEFT JOIN %site_name...                                                             ^',
                                         payload=('', 25, 0),
                                         sql='SELECT items.item_uuid as item_uuid,    items.item_name as item_name,    units.fullname AS fullname,    units.id AS unit_id,    items.links AS linksFROM main_items itemsLEFT JOIN main_item_info item_info ON item_info.id = items.item_info_idLEFT JOIN units ON item_info.uom = units.idWHERE items.search_string LIKE '%%' || %s || '%%'    AND items.inactive IS false    AND item_info.safety_stock > 0ORDER BY items.item_name LIMIT %s OFFSET %s;')
2025-08-21 18:44:41.870684 --- ERROR --- DatabaseError(message='column "name" does not existLINE 1: SELECT * FROM test_vendors ORDER BY name ASC LIMIT 10 OFFSET...                                            ^',
                                         payload=(10, 0),
                                         sql='SELECT * FROM test_vendors ORDER BY name ASC LIMIT %s OFFSET %s;')
2025-08-23 07:01:48.754381 --- ERROR --- DatabaseError(message='column rp_item.type does not existLINE 11: ...       SELECT items.id AS item_id, rp_item.rp_id, rp_item.ty...                                                              ^',
                                         payload=(2025, 8),
                                         sql='WITH arguments AS (  SELECT %s AS year, %s AS month),sum_cte AS (      SELECT mi.item_uuid, SUM(mil.quantity_on_hand)::FLOAT8 AS total_sum      FROM main_item_locations mil      JOIN main_items mi ON mil.part_id = mi.id      GROUP BY mi.id    ),cte_recipe_items AS (        SELECT items.id AS item_id, rp_item.rp_id, rp_item.type, rp_item.qty, rp_item.uom AS ingrediant_uom, item_info.uom AS item_uom, COALESCE(sum_cte.total_sum, 0) as quantity_on_hand FROM main_recipe_items rp_item        LEFT JOIN sum_cte ON sum_cte.item_uuid = rp_item.item_uuid        LEFT JOIN main_items items ON rp_item.item_uuid = items.item_uuid        LEFT JOIN main_item_info item_info ON items.item_info_id = item_info.id     )  SELECT events.*,      COALESCE(row_to_json(recipes.*), '{}') as recipe,      COALESCE(ritems.recipe_items, '{}') as recipe_itemsFROM main_plan_events eventsLEFT JOIN main_recipes recipes ON recipes.recipe_uuid = events.recipe_uuidLEFT JOIN LATERAL (  SELECT array_agg(row_to_json(ri.*)) AS recipe_items  FROM cte_recipe_items ri  WHERE ri.rp_id = recipes.id) ritems ON TRUEWHERE  event_date_end >= make_date((SELECT year FROM arguments), (SELECT month FROM arguments), 1)  AND  event_date_start <  (make_date((SELECT year FROM arguments), (SELECT month FROM arguments), 1) + INTERVAL '1 month');')
2025-08-23 09:44:32.979264 --- ERROR --- DatabaseError(message='can't adapt type 'dict'',
                                         payload={'food_groups': [], 'ingrediants': [], 'nutrients': {}, 'expires': False, 'default_expiration': 0.0},
                                         sql='INSERT INTO test2_food_info(ingrediants, food_groups, nutrients, expires, default_expiration) VALUES (%(ingrediants)s, %(food_groups)s, %(nutrients)s, %(expires)s, %(default_expiration)s) RETURNING *;')
2025-08-23 09:47:55.518415 --- ERROR --- DatabaseError(message=''default_expiration'',
                                         payload={'food_groups': '[]', 'ingrediants': '[]', 'nutrients': '{}', 'expires': False, 'default_exipration': 0.0},
                                         sql='INSERT INTO test2_food_info(ingrediants, food_groups, nutrients, expires, default_expiration) VALUES (%(ingrediants)s, %(food_groups)s, %(nutrients)s, %(expires)s, %(default_expiration)s) RETURNING *;')
2025-08-23 09:48:20.421772 --- ERROR --- DatabaseError(message='malformed array literal: "[]"LINE 3: VALUES ('[]', '[]', '{}', false, 0.0)                 ^DETAIL:  "[" must introduce explicitly-specified array dimensions.',
                                         payload={'food_groups': '[]', 'ingrediants': '[]', 'nutrients': '{}', 'expires': False, 'default_expiration': 0.0},
                                         sql='INSERT INTO test2_food_info(ingrediants, food_groups, nutrients, expires, default_expiration) VALUES (%(ingrediants)s, %(food_groups)s, %(nutrients)s, %(expires)s, %(default_expiration)s) RETURNING *;')
2025-08-23 09:56:18.404047 --- ERROR --- DatabaseError(message='malformed array literal: "[]"LINE 3: VALUES ('1234', '', 1.0, 1, 0.0, 0.0, 0.0, false, '[]')                                                           ^DETAIL:  "[" must introduce explicitly-specified array dimensions.',
                                         payload={'barcode': '1234', 'packaging': '', 'uom_quantity': 1.0, 'uom': 1, 'cost': 0.0, 'safety_stock': 0.0, 'lead_time_days': 0.0, 'ai_pick': False, 'prefixes': '[]'},
                                         sql='INSERT INTO test2_item_info(barcode, packaging, uom_quantity, uom, cost, safety_stock, lead_time_days, ai_pick, prefixes) VALUES (%(barcode)s, %(packaging)s, %(uom_quantity)s, %(uom)s, %(cost)s, %(safety_stock)s, %(lead_time_days)s, %(ai_pick)s, %(prefixes)s) RETURNING *;')
2025-08-23 10:00:20.053169 --- ERROR --- DatabaseError(message='relation "test2_locations" does not exist',
                                         payload=CREATE TABLE IF NOT EXISTS test2_logistics_info(
    id SERIAL PRIMARY KEY,
    logistics_info_uuid UUID DEFAULT uuid_generate_v4(),
    barcode VARCHAR(255),
    primary_location INTEGER NOT NULL,
    primary_zone INTEGER NOT NULL,
    auto_issue_location INTEGER NOT NULL,
    auto_issue_zone INTEGER NOT NULL,
    UNIQUE(logistics_info_uuid),
    CONSTRAINT fk_primary_location
        FOREIGN KEY(primary_location) 
        REFERENCES test2_locations(id),
    CONSTRAINT fk_primary_zone
        FOREIGN KEY(primary_zone) 
        REFERENCES test2_zones(id),
    CONSTRAINT fk_auto_issue_location
        FOREIGN KEY(auto_issue_location) 
        REFERENCES test2_locations(id),
    CONSTRAINT fk_auto_issue_zone
        FOREIGN KEY(auto_issue_zone) 
        REFERENCES test2_zones(id)
);,
                                         sql='logistics_info')
2025-08-23 11:30:10.936510 --- ERROR --- DatabaseError(message='function gen_random_uuid4() does not existLINE 2:     plan_uuid UUID PRIMARY KEY DEFAULT gen_random_uuid4(),                                               ^HINT:  No function matches the given name and argument types. You might need to add explicit type casts.',
                                         payload=CREATE TABLE IF NOT EXISTS test2_plans(
    plan_uuid UUID PRIMARY KEY DEFAULT gen_random_uuid4(),
    plan_shortname VARCHAR(32) NOT NULL,
    plan_description TEXT,
    created_by INTEGER NOT NULL
)
,
                                         sql='plans')