Skip to content

Instantly share code, notes, and snippets.

@jeff
Created November 7, 2018 18:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeff/338326337eed82f1a60cde1f388b2123 to your computer and use it in GitHub Desktop.
Save jeff/338326337eed82f1a60cde1f388b2123 to your computer and use it in GitHub Desktop.
ruling out a copy visibility issue
WITH base_vis_mask AS (
SELECT c_attrs
FROM asset.patron_default_visibility_mask()
),
circ_lib_mask AS (
SELECT search.calculate_visibility_attribute_test('circ_lib', ARRAY_AGG(aoud.id)) AS mask
FROM actor.org_unit_descendants(1) AS aoud
),
visible_copies AS (
SELECT target_copy
FROM asset.copy_vis_attr_cache AS acvac,
base_vis_mask, circ_lib_mask
WHERE
acvac.vis_attr_vector @@ (base_vis_mask.c_attrs || '&' || circ_lib_mask.mask)::query_int
) select * from visible_copies where target_copy in (select id from asset.copy where deleted = false and call_number in (select id from asset.call_number where deleted = false and record = 693452));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment