-- ACL format checks select ''::ace_uuid; select 'a'::ace_uuid; select 'q'::ace_uuid; select 'a*'::ace_uuid; select 'a/'::ace_uuid; select 'a/hq'::ace_uuid; select 'a/h'::ace_uuid; select 'a/h/'::ace_uuid; select 'a/h/='::ace_uuid; select 'a/h/00000000-0000-0000-0000-000000000001='::ace_uuid; select 'a/h/00000000-0000-0000-0000-000000000001=d,'::ace_uuid; select 'a/h/00000000-0000-0000-0000-000000000001=dw'::ace_uuid; select 'a/ihpc/00000000-0000-0000-0000-000000000001=wdddw'::ace_uuid; select 'd/ihpc/00000000-0000-0000-0000-000000000001=wdddw'::ace_uuid; select 'd/ihpc/a0000000-ffff-b000-c000-d00000000001=wdddw'::ace_uuid; select 'a/ihpc/blah"=dw0'::ace_uuid; select 'd/ihpc/a0000000-ffff-b000-c000-d000000000010000=wdddw'::ace_uuid; -- check access select coalesce(acl_check_access('{}'::ace_uuid[], 'sd0', '{00000000-0000-0000-0000-000000000003, 00000000-0000-0000-0000-000000000002}'::uuid[], false), 'NULL'); select coalesce(acl_check_access('{}'::ace_uuid[], 'sd0', '{00000000-0000-0000-0000-000000000003, 00000000-0000-0000-0000-000000000002}'::uuid[], true), 'NULL'); select coalesce(acl_check_access(null::ace_uuid[], 'sd0', '{00000000-0000-0000-0000-000000000003, 00000000-0000-0000-0000-000000000002}'::uuid[], false), 'NULL'); select coalesce(acl_check_access(null::ace_uuid[], 'sd0', '{00000000-0000-0000-0000-000000000003, 00000000-0000-0000-0000-000000000002}'::uuid[], true), 'NULL'); select coalesce(acl_check_access(null::ace_uuid[], 'sd0', '{}'::uuid[], false), 'NULL'); select coalesce(acl_check_access(null::ace_uuid[], 'sd0', '{}'::uuid[], true), 'NULL'); select coalesce(acl_check_access(null::ace_uuid[], 'sd0', null::uuid[], false), 'NULL'); select coalesce(acl_check_access(null::ace_uuid[], 'sd0', null::uuid[], true), 'NULL'); select acl_check_access('{}'::ace_uuid[], (1 << 0) | (1 << 27) | (1 << 29), '{00000000-0000-0000-0000-000000000003, 00000000-0000-0000-0000-000000000002}'::uuid[], false)::bit(32); select acl_check_access('{}'::ace_uuid[], (1 << 0) | (1 << 27) | (1 << 29), '{00000000-0000-0000-0000-000000000003, 00000000-0000-0000-0000-000000000002}'::uuid[], true)::bit(32); select acl_check_access(null::ace_uuid[], (1 << 0) | (1 << 27) | (1 << 29), '{00000000-0000-0000-0000-000000000003, 00000000-0000-0000-0000-000000000002}'::uuid[], false)::bit(32); select acl_check_access(null::ace_uuid[], (1 << 0) | (1 << 27) | (1 << 29), '{00000000-0000-0000-0000-000000000003, 00000000-0000-0000-0000-000000000002}'::uuid[], true)::bit(32); select acl_check_access(null::ace_uuid[], (1 << 0) | (1 << 27) | (1 << 29), '{}'::uuid[], false)::bit(32); select acl_check_access(null::ace_uuid[], (1 << 0) | (1 << 27) | (1 << 29), '{}'::uuid[], true)::bit(32); select acl_check_access(null::ace_uuid[], (1 << 0) | (1 << 27) | (1 << 29), null::uuid[], false)::bit(32); select acl_check_access(null::ace_uuid[], (1 << 0) | (1 << 27) | (1 << 29), null::uuid[], true)::bit(32); select coalesce(acl_check_access('{d//00000000-0000-0000-0000-000000000001=w,d//00000000-0000-0000-0000-000000000002=s,a//00000000-0000-0000-0000-000000000002=sdw,a//00000000-0000-0000-0000-000000000003=0}'::ace_uuid[], 'sdc0', '{00000000-0000-0000-0000-000000000003, 00000000-0000-0000-0000-000000000002}'::uuid[], false), 'NULL'); select coalesce(acl_check_access('{d//00000000-0000-0000-0000-000000000001=w,d//00000000-0000-0000-0000-000000000002=s,a//00000000-0000-0000-0000-000000000002=sdw,a//00000000-0000-0000-0000-000000000003=0}'::ace_uuid[], 'sdc0', '{00000000-0000-0000-0000-000000000003, 00000000-0000-0000-0000-000000000002}'::uuid[], true), 'NULL'); select acl_check_access('{d//00000000-0000-0000-0000-000000000001=w,d//00000000-0000-0000-0000-000000000002=s,a//00000000-0000-0000-0000-000000000002=sdw,a//00000000-0000-0000-0000-000000000003=0}'::ace_uuid[], (1 << 0) | (1 << 27) | (1 << 29), '{00000000-0000-0000-0000-000000000003, 00000000-0000-0000-0000-000000000002}'::uuid[], false)::bit(32); select acl_check_access('{d//00000000-0000-0000-0000-000000000001=w,d//00000000-0000-0000-0000-000000000002=s,a//00000000-0000-0000-0000-000000000002=sdw,a//00000000-0000-0000-0000-000000000003=0}'::ace_uuid[], (1 << 0) | (1 << 27) | (1 << 29), '{00000000-0000-0000-0000-000000000003, 00000000-0000-0000-0000-000000000002}'::uuid[], true)::bit(32); select coalesce(acl_check_access(null::ace_uuid[], 'sd0', '{}'::uuid[], null), 'NULL'); select acl_check_access(null::ace_uuid[], (1 << 0) | (1 << 27) | (1 << 29), '{}'::uuid[], null)::bit(32); -- inherit only select coalesce(acl_check_access('{d//00000000-0000-0000-0000-000000000001=w,d/i/00000000-0000-0000-0000-000000000002=s,a//00000000-0000-0000-0000-000000000002=sdw,a//00000000-0000-0000-0000-000000000003=0}'::ace_uuid[], 'sd0', '{00000000-0000-0000-0000-000000000003, 00000000-0000-0000-0000-000000000002}'::uuid[], false), 'NULL'); select acl_check_access('{d//00000000-0000-0000-0000-000000000001=w,d/i/00000000-0000-0000-0000-000000000002=s,a//00000000-0000-0000-0000-000000000002=sdw,a//00000000-0000-0000-0000-000000000003=0}'::ace_uuid[], (1 << 0) | (1 << 27) | (1 << 29), '{00000000-0000-0000-0000-000000000003, 00000000-0000-0000-0000-000000000002}'::uuid[], false)::bit(32); -- merge select acl_merge(null::ace_uuid[], '{a//00000000-0000-0000-0000-000000000000=0,d//00000000-0000-0000-0000-000000000000=1,a//00000000-0000-0000-0000-000000000000=23,d//00000000-0000-0000-0000-000000000000=4}'::ace_uuid[], true, false); select acl_merge(null::ace_uuid[], '{a//00000000-0000-0000-0000-000000000000=0,d//00000000-0000-0000-0000-000000000000=1,a//00000000-0000-0000-0000-000000000000=23,d//00000000-0000-0000-0000-000000000000=4}'::ace_uuid[], true, true); select acl_merge(null::ace_uuid[], '{a//00000000-0000-0000-0000-000000000000=0,d//00000000-0000-0000-0000-000000000000=1,a//00000000-0000-0000-0000-000000000000=23,d//00000000-0000-0000-0000-000000000000=4}'::ace_uuid[], false, false); select acl_merge(null::ace_uuid[], '{a//00000000-0000-0000-0000-000000000000=0,d//00000000-0000-0000-0000-000000000000=1,a//00000000-0000-0000-0000-000000000000=23,d//00000000-0000-0000-0000-000000000000=4}'::ace_uuid[], false, true); -- inheritance -- container -- no flags -> not inherited select acl_merge('{a//00000000-0000-0000-0000-000000000001=d}'::ace_uuid[], '{a//00000000-0000-0000-0000-000000000000=0,d//00000000-0000-0000-0000-000000000000=1,a//00000000-0000-0000-0000-000000000000=23,d//00000000-0000-0000-0000-000000000000=4}'::ace_uuid[], true, false); -- inherit only -> not inherited select acl_merge('{a/i/00000000-0000-0000-0000-000000000001=d}'::ace_uuid[], '{a//00000000-0000-0000-0000-000000000000=0,d//00000000-0000-0000-0000-000000000000=1,a//00000000-0000-0000-0000-000000000000=23,d//00000000-0000-0000-0000-000000000000=4}'::ace_uuid[], true, false); -- object inherit -> inherit only + object inherit select acl_merge('{a/o/00000000-0000-0000-0000-000000000001=d}'::ace_uuid[], '{a//00000000-0000-0000-0000-000000000000=0,d//00000000-0000-0000-0000-000000000000=1,a//00000000-0000-0000-0000-000000000000=23,d//00000000-0000-0000-0000-000000000000=4}'::ace_uuid[], true, false); -- inherit only + object inherit -> inherit only + object inherit select acl_merge('{a/io/00000000-0000-0000-0000-000000000001=d}'::ace_uuid[], '{a//00000000-0000-0000-0000-000000000000=0,d//00000000-0000-0000-0000-000000000000=1,a//00000000-0000-0000-0000-000000000000=23,d//00000000-0000-0000-0000-000000000000=4}'::ace_uuid[], true, false); -- object inherit + no propagate inherit -> no inheritance select acl_merge('{a/op/00000000-0000-0000-0000-000000000001=d}'::ace_uuid[], '{a//00000000-0000-0000-0000-000000000000=0,d//00000000-0000-0000-0000-000000000000=1,a//00000000-0000-0000-0000-000000000000=23,d//00000000-0000-0000-0000-000000000000=4}'::ace_uuid[], true, false); -- inherit only + object inherit + no propagate inherit -> no inheritance select acl_merge('{a/iop/00000000-0000-0000-0000-000000000001=d}'::ace_uuid[], '{a//00000000-0000-0000-0000-000000000000=0,d//00000000-0000-0000-0000-000000000000=1,a//00000000-0000-0000-0000-000000000000=23,d//00000000-0000-0000-0000-000000000000=4}'::ace_uuid[], true, false); -- container inherit -> container inherit select acl_merge('{a/c/00000000-0000-0000-0000-000000000001=d}'::ace_uuid[], '{a//00000000-0000-0000-0000-000000000000=0,d//00000000-0000-0000-0000-000000000000=1,a//00000000-0000-0000-0000-000000000000=23,d//00000000-0000-0000-0000-000000000000=4}'::ace_uuid[], true, false); -- inherit only + container inherit -> container inherit select acl_merge('{a/ic/00000000-0000-0000-0000-000000000001=d}'::ace_uuid[], '{a//00000000-0000-0000-0000-000000000000=0,d//00000000-0000-0000-0000-000000000000=1,a//00000000-0000-0000-0000-000000000000=23,d//00000000-0000-0000-0000-000000000000=4}'::ace_uuid[], true, false); -- container inherit + no propagate inherit -> no flags select acl_merge('{a/cp/00000000-0000-0000-0000-000000000001=d}'::ace_uuid[], '{a//00000000-0000-0000-0000-000000000000=0,d//00000000-0000-0000-0000-000000000000=1,a//00000000-0000-0000-0000-000000000000=23,d//00000000-0000-0000-0000-000000000000=4}'::ace_uuid[], true, false); -- inherit only + container inherit + no propagate inherit -> no flags select acl_merge('{a/icp/00000000-0000-0000-0000-000000000001=d}'::ace_uuid[], '{a//00000000-0000-0000-0000-000000000000=0,d//00000000-0000-0000-0000-000000000000=1,a//00000000-0000-0000-0000-000000000000=23,d//00000000-0000-0000-0000-000000000000=4}'::ace_uuid[], true, false); -- container inherit + object inherit -> container inherit + object inherit select acl_merge('{a/co/00000000-0000-0000-0000-000000000001=d}'::ace_uuid[], '{a//00000000-0000-0000-0000-000000000000=0,d//00000000-0000-0000-0000-000000000000=1,a//00000000-0000-0000-0000-000000000000=23,d//00000000-0000-0000-0000-000000000000=4}'::ace_uuid[], true, false); -- inherit only + container inherit + object inherit -> container inherit + object inherit select acl_merge('{a/ico/00000000-0000-0000-0000-000000000001=d}'::ace_uuid[], '{a//00000000-0000-0000-0000-000000000000=0,d//00000000-0000-0000-0000-000000000000=1,a//00000000-0000-0000-0000-000000000000=23,d//00000000-0000-0000-0000-000000000000=4}'::ace_uuid[], true, false); -- container inherit + object inherit + no propagate inherit -> no flags select acl_merge('{a/cop/00000000-0000-0000-0000-000000000001=d}'::ace_uuid[], '{a//00000000-0000-0000-0000-000000000000=0,d//00000000-0000-0000-0000-000000000000=1,a//00000000-0000-0000-0000-000000000000=23,d//00000000-0000-0000-0000-000000000000=4}'::ace_uuid[], true, false); -- inherit only + container inherit + object inherit + no propagate inherit -> no flags select acl_merge('{a/icop/00000000-0000-0000-0000-000000000001=d}'::ace_uuid[], '{a//00000000-0000-0000-0000-000000000000=0,d//00000000-0000-0000-0000-000000000000=1,a//00000000-0000-0000-0000-000000000000=23,d//00000000-0000-0000-0000-000000000000=4}'::ace_uuid[], true, false); -- skip inherited select acl_merge('{a/h/00000000-0000-0000-0000-000000000001=d}'::ace_uuid[], '{a//00000000-0000-0000-0000-000000000000=0,d//00000000-0000-0000-0000-000000000000=1,a//00000000-0000-0000-0000-000000000000=23,d//00000000-0000-0000-0000-000000000000=4}'::ace_uuid[], true, false); -- object -- no flags -> not inherited select acl_merge('{a//00000000-0000-0000-0000-000000000001=d}'::ace_uuid[], '{a//00000000-0000-0000-0000-000000000000=0,d//00000000-0000-0000-0000-000000000000=1,a//00000000-0000-0000-0000-000000000000=23,d//00000000-0000-0000-0000-000000000000=4}'::ace_uuid[], false, false); -- inherit only -> not inherited select acl_merge('{a/i/00000000-0000-0000-0000-000000000001=d}'::ace_uuid[], '{a//00000000-0000-0000-0000-000000000000=0,d//00000000-0000-0000-0000-000000000000=1,a//00000000-0000-0000-0000-000000000000=23,d//00000000-0000-0000-0000-000000000000=4}'::ace_uuid[], false, false); -- object inherit -> no flags select acl_merge('{a/o/00000000-0000-0000-0000-000000000001=d}'::ace_uuid[], '{a//00000000-0000-0000-0000-000000000000=0,d//00000000-0000-0000-0000-000000000000=1,a//00000000-0000-0000-0000-000000000000=23,d//00000000-0000-0000-0000-000000000000=4}'::ace_uuid[], false, false); -- inherit only + object inherit -> no flags select acl_merge('{a/io/00000000-0000-0000-0000-000000000001=d}'::ace_uuid[], '{a//00000000-0000-0000-0000-000000000000=0,d//00000000-0000-0000-0000-000000000000=1,a//00000000-0000-0000-0000-000000000000=23,d//00000000-0000-0000-0000-000000000000=4}'::ace_uuid[], false, false); -- object inherit + no propagate inherit -> no flags select acl_merge('{a/op/00000000-0000-0000-0000-000000000001=d}'::ace_uuid[], '{a//00000000-0000-0000-0000-000000000000=0,d//00000000-0000-0000-0000-000000000000=1,a//00000000-0000-0000-0000-000000000000=23,d//00000000-0000-0000-0000-000000000000=4}'::ace_uuid[], false, false); -- inherit only + object inherit + no propagate inherit -> no flags select acl_merge('{a/iop/00000000-0000-0000-0000-000000000001=d}'::ace_uuid[], '{a//00000000-0000-0000-0000-000000000000=0,d//00000000-0000-0000-0000-000000000000=1,a//00000000-0000-0000-0000-000000000000=23,d//00000000-0000-0000-0000-000000000000=4}'::ace_uuid[], false, false); -- container inherit -> not inherited select acl_merge('{a/c/00000000-0000-0000-0000-000000000001=d}'::ace_uuid[], '{a//00000000-0000-0000-0000-000000000000=0,d//00000000-0000-0000-0000-000000000000=1,a//00000000-0000-0000-0000-000000000000=23,d//00000000-0000-0000-0000-000000000000=4}'::ace_uuid[], false, false); -- inherit only + container inherit -> not inherited select acl_merge('{a/ic/00000000-0000-0000-0000-000000000001=d}'::ace_uuid[], '{a//00000000-0000-0000-0000-000000000000=0,d//00000000-0000-0000-0000-000000000000=1,a//00000000-0000-0000-0000-000000000000=23,d//00000000-0000-0000-0000-000000000000=4}'::ace_uuid[], false, false); -- container inherit + no propagate inherit -> not inherited select acl_merge('{a/cp/00000000-0000-0000-0000-000000000001=d}'::ace_uuid[], '{a//00000000-0000-0000-0000-000000000000=0,d//00000000-0000-0000-0000-000000000000=1,a//00000000-0000-0000-0000-000000000000=23,d//00000000-0000-0000-0000-000000000000=4}'::ace_uuid[], false, false); -- inherit only + container inherit + no propagate inherit -> not inherited select acl_merge('{a/icp/00000000-0000-0000-0000-000000000001=d}'::ace_uuid[], '{a//00000000-0000-0000-0000-000000000000=0,d//00000000-0000-0000-0000-000000000000=1,a//00000000-0000-0000-0000-000000000000=23,d//00000000-0000-0000-0000-000000000000=4}'::ace_uuid[], false, false); -- container inherit + object inherit -> no flags select acl_merge('{a/co/00000000-0000-0000-0000-000000000001=d}'::ace_uuid[], '{a//00000000-0000-0000-0000-000000000000=0,d//00000000-0000-0000-0000-000000000000=1,a//00000000-0000-0000-0000-000000000000=23,d//00000000-0000-0000-0000-000000000000=4}'::ace_uuid[], false, false); -- inherit only + container inherit + object inherit -> no flags select acl_merge('{a/ico/00000000-0000-0000-0000-000000000001=d}'::ace_uuid[], '{a//00000000-0000-0000-0000-000000000000=0,d//00000000-0000-0000-0000-000000000000=1,a//00000000-0000-0000-0000-000000000000=23,d//00000000-0000-0000-0000-000000000000=4}'::ace_uuid[], false, false); -- container inherit + object inherit + no propagate inherit -> no flags select acl_merge('{a/cop/00000000-0000-0000-0000-000000000001=d}'::ace_uuid[], '{a//00000000-0000-0000-0000-000000000000=0,d//00000000-0000-0000-0000-000000000000=1,a//00000000-0000-0000-0000-000000000000=23,d//00000000-0000-0000-0000-000000000000=4}'::ace_uuid[], false, false); -- inherit only + container inherit + object inherit + no propagate inherit -> no flags select acl_merge('{a/icop/00000000-0000-0000-0000-000000000001=d}'::ace_uuid[], '{a//00000000-0000-0000-0000-000000000000=0,d//00000000-0000-0000-0000-000000000000=1,a//00000000-0000-0000-0000-000000000000=23,d//00000000-0000-0000-0000-000000000000=4}'::ace_uuid[], false, false); -- skip inherited select acl_merge('{a/h/00000000-0000-0000-0000-000000000001=d}'::ace_uuid[], '{a//00000000-0000-0000-0000-000000000000=0,d//00000000-0000-0000-0000-000000000000=1,a//00000000-0000-0000-0000-000000000000=23,d//00000000-0000-0000-0000-000000000000=4}'::ace_uuid[], false, false);