CREATE OR REPLACE FUNCTION layer_barrier(bbox geometry, zoom_level int) RETURNS TABLE(geometry geometry, subclass text) AS $$ SELECT geometry, subclass FROM osm_barrier_linestring WHERE zoom_level >= 14 AND geometry && bbox; $$ LANGUAGE SQL IMMUTABLE;