-- 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');