AndOp 函数返回两个日历模式的交集。
AndOp ( cal_patt1 CalendarPattern, cal_patt2 CalendarPattern) returns CalendarPattern;
此函数返回的日历模式中所包含的每个时间间隔都处于启用状态,并且都是两个日历模式中已启用的时间间隔;其余时间间隔处于禁用状态。如果给定模式没有相同的时间间隔单位,那么具有较大时间间隔单位的模式将通过扩展来与其他模式匹配。
由 AND 运算符组合两个其他日历模式而形成的一个日历模式。
select * from CalendarPatterns where cp_name = 'workweek_day'; cp_name workweek_day cp_pattern {1 off,5 on,1 off},day select * from CalendarPatterns where cp_name = 'fourday_day'; cp_name fourday_day cp_pattern {1 off,4 on,2 off},day select * from CalendarPatterns where cp_name = 'workweek_hour'; cp_name workweek_hour cp_pattern {32 off,9 on,15 off,9 on,15 off,9 on,15 off, 9 on,15 off,9 on,31 off},hour select AndOp(p1.cp_pattern, p2.cp_pattern) from CalendarPatterns p1, CalendarPatterns p2 where p1.cp_name = 'workweek_day' and p2.cp_name = 'fourday_day'; (expression) {1 off,4 on,2 off},day select AndOp(p1.cp_pattern, p2.cp_pattern) from CalendarPatterns p1, CalendarPatterns p2 where p1.cp_name = 'workweek_hour' and p2.cp_name = 'fourday_day'; (expression) {32 off,9 on,15 off,9 on,15 off,9 on,15 off,9 on,55 off},hour