LASQU

Merge SQU1T and SQU1J to SQU1

SQU 1T and 1J are the same spatial area, but the 1J QMA is specific to jigging. This is the only method-specific QMA and the only case where there are overlapping QMAs for a species.

This grooming rule is primarily to avoid the need to deal with overlapping QMAs in ghoti.

-- © Copyright 2026 The Kahawai Collective
-- SPDX-License-Identifier: MIT
INSERT INTO grooming_rules
VALUES ('LASQU', 'edw', 'landings', 'Fix', 'Recode SQU1J and SQU1T landings to SQU1');

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

INSERT INTO groomed.checks(code, "table", "column", id, orig, new)
SELECT 'LASQU', 'landings', 'fishstock_code', id, fishstock_code, 'SQU1'
FROM   groomed.landings
WHERE  fishstock_code IN ('SQU1J','SQU1T');

UPDATE groomed.landings
SET    checks = array_append(checks,'LASQU'),
       fishstock_code = u.new
FROM   groomed.checks u
WHERE  u.code = 'LASQU'
AND    u.column = 'fishstock_code'
AND    groomed.landings.id = u.id
AND    groomed.landings.fishstock_code = u.orig;

$$ LANGUAGE SQL VOLATILE;

SELECT LASQU();
Effects of grooming
Figure 1: The number of records affected by the LASQU rule, by year and source.
Figure 2: The proportion of records affected by the LASQU rule, by form type, for all form types where some records are groomed by the LASQU rule.