LADAF

Landing date is in the future

-- © Copyright 2026 The Kahawai Collective
-- SPDX-License-Identifier: MIT
INSERT INTO grooming_rules
VALUES ('LADAF', 'edw', 'landings', 'Flag', 'Landings where the landing date is in the future');

CREATE OR REPLACE FUNCTION LADAF() RETURNS VOID AS $$

INSERT INTO groomed.checks(code, "table", "column", id)
SELECT 'LADAF', 'landings', 'landing_datetime', id
FROM   groomed.landings
WHERE  landing_datetime > current_timestamp;

UPDATE groomed.landings
SET    checks=array_append(checks, 'LADAF')
WHERE  id IN (SELECT id FROM groomed.checks WHERE code = 'LADAF');

$$ LANGUAGE SQL;

SELECT LADAF();
Effects of grooming