This isn't feature-complete yet, but opening as a place to start a con-
versation around how to fully implement this feature.
At the moment, the prohibition on partitioned tables is removed, and
hooks are added to handle ATTACH PARTITION and DETACH PARTITION.
To do:
* Add check to prohibit multiple partitioned tables (causes crash)
* Change ATTACH/DETACH to be incremental (presently does a REFRESH)
* Figure out issue with multiple tables and correct it
refresh_immv(immv_name, with_data) is a function to refresh IMMV like
REFRESH MATERIALIZED VIEW command. It has two argument.
immv_name is incrementally maintainable materialized view's name, and
with_data is an option that is corresponding to the WITH [NO] DATA option.
When with_data is set false, the IMMV gets unpopulated.
One of differences between IMMVs unpopulated by this function and
normal materialized views unpopulated by REFRESH ... WITH NO DATA
is that such IMMVs can be referenced by SELECT but return no rows,
while unpopulated materialized views are not scanable.
The behaviour may be changed in future to raise an error when unpopulated
an IMMV is scanned.
This currently crashes the server: `SELECT create_immv(NULL, 'SELECT * FROM test');` . Marking the function STRICT will avoid calling it with NULL arguments.
Alternative would be check for NULLs in create_immv.