Files
aevolution/migrations/0050_world_region_catalog.sql
T
dingo 145e6e1445
Foundation / checks (deploy) (push) Successful in 58s
Foundation / checks (ecs) (push) Successful in 2m36s
Foundation / checks (network) (push) Successful in 20m56s
Foundation / checks (client) (push) Successful in 22m19s
Foundation / checks (tsan) (push) Successful in 25m18s
Foundation / postgres-tools (push) Canceled after 0s
Foundation / server-image (push) Canceled after 0s
Foundation / image (push) Canceled after 0s
Foundation / checks (checks) (push) Canceled after 44m49s
Foundation / checks (postgres) (push) Canceled after 44m54s
M12.7: require registered regions in census snapshots
2026-10-18 19:48:23 -04:00

16 lines
905 B
PL/PgSQL

-- ADR-0154: the authority registry is also the source of census owner coverage.
-- The 65th row detects overflow; callers must never treat a prefix as complete.
CREATE FUNCTION evolution.load_world_region_catalog_v1(w evolution.u64)
RETURNS TABLE(region_id evolution.u64,frame_id evolution.u64)
LANGUAGE plpgsql STABLE SECURITY DEFINER SET search_path=pg_catalog,pg_temp AS $$
BEGIN
IF w IS NULL OR w=0 THEN
RAISE EXCEPTION 'invalid world identity' USING ERRCODE='22023';
END IF;
RETURN QUERY SELECT r.region_id,r.frame_id FROM evolution.region_leases r
WHERE r.world_id=w ORDER BY r.region_id LIMIT 65;
END $$;
REVOKE ALL ON FUNCTION evolution.load_world_region_catalog_v1(evolution.u64) FROM PUBLIC;
GRANT EXECUTE ON FUNCTION evolution.load_world_region_catalog_v1(evolution.u64) TO :"runtime_role";
INSERT INTO evolution.schema_migrations(version,sha256) VALUES(50,:'migration_sha_50');