pg_ivm/sql
thoshiai fc2339e16c
Fix checking for expressions containing an EXISTS subquery (#71)
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>
2024-03-01 20:33:56 +09:00
..
create_immv.sql Fix segmentation fault in incorrect view def (#39) 2022-12-15 19:03:49 +09:00
pg_ivm.sql Fix checking for expressions containing an EXISTS subquery (#71) 2024-03-01 20:33:56 +09:00
refresh_immv.sql Improve refresh_immv behavior a bit 2022-06-23 11:33:06 +09:00