EXISTS subquery is currently allowed only directly under WHERE clause or in AND expression that is directly under WHERE. However, the check was insufficient previously so that views using expressions other than AND containing an EXISTS subquery could be created without an error and it caused incorrect maintenance results. To fix this check, add a new boolean member allow_context into check_ivm_restriction_context. This member means whether EXISTS subquery is allowed in the current node being examined in check_ivm_restriction_walker. This should be set to true just before calling check_ivm_restriction_walker for nodes directly under WHERE or operands of AND expression direct under WHERE, and is reset to false on every call of the function. In passing, move the check for OR and NOT expression from rewrite_exists_subquery_walker to check_ivm_restriction_context, with some code cleaning. --------- Co-authored-by: Yugo Nagata <nagata@sraoss.co.jp> |
||
|---|---|---|
| .. | ||
| create_immv.out | ||
| pg_ivm.out | ||
| refresh_immv.out | ||