3 SELECT evergreen.upgrade_deps_block_check('1065', :eg_version);
5 CREATE TABLE serial.pattern_template (
8 pattern_code TEXT NOT NULL,
9 owning_lib INTEGER REFERENCES actor.org_unit(id) DEFERRABLE INITIALLY DEFERRED,
10 share_depth INTEGER NOT NULL DEFAULT 0
12 CREATE INDEX serial_pattern_template_name_idx ON serial.pattern_template (evergreen.lowercase(name));
14 CREATE OR REPLACE FUNCTION serial.pattern_templates_visible_to(org_unit INT) RETURNS SETOF serial.pattern_template AS $func$
17 FROM serial.pattern_template spt
20 FROM actor.org_unit_descendants(spt.owning_lib, spt.share_depth)
21 ) @@ org_unit::TEXT::QUERY_INT;
23 $func$ LANGUAGE PLPGSQL;