LADTI
Destination type is invalid
This check flags invalid destination codes based on the list of valid codes maintained in the public.destination_type table from published Regulations and Circulars.
-- © Copyright 2026 The Kahawai Collective
-- SPDX-License-Identifier: MIT
INSERT INTO grooming_rules
VALUES ('LADTI', 'edw', 'landings', 'Flag', 'Invalid landing destination');
CREATE OR REPLACE FUNCTION LADTI() RETURNS VOID AS $$
INSERT INTO groomed.checks(code, "table", "column", id)
SELECT 'LADTI', 'landings', 'destination_type', id
FROM groomed.landings
WHERE destination_type NOT IN (SELECT code FROM public.destination_type);
UPDATE groomed.landings
SET checks=array_append(checks, 'LADTI')
WHERE id IN (SELECT id FROM groomed.checks WHERE code = 'LADTI');
$$ LANGUAGE SQL;
SELECT LADTI();Effects of grooming