Commit graph

4 commits

Author SHA1 Message Date
Yugo Nagata
e31dc21eaa
Use object_access_hook to drop an IMMV entry from pg_ivm_immv (#29)
Previously, we used an event trigger and executed DELETE command,
but it caused a privilege error when non-superuser dropped a table
even if it is irrelevant to IMMV.

To fix it, we now use object_access_hook and an entry is deleted
via CatalogTupleDelete which doesn't need the superuser privilege.

Issue #25
2022-09-30 23:49:51 +09:00
thoshiai
1d21409321
Add get_immv_def func (#23)
get_immv_def reconstructs the underlying SELECT command for a
IMMV. This is a decompiled reconstruction, not the original text
of the command.
2022-09-30 18:59:51 +09:00
Yugo Nagata
b6702f9a3a
Use snapshot to check tuple visibility in pre-update state (#28)
When multiple tables are updated or the view contains a self-join,
we need to calculate table states that was before it is modified
during incremental view maintenance. For get the pre-update state,
tuples inserted in a command must be removed when the table is scanned.

Previously, we used xmin and cmin system columns for this purpose,
but this way is problematic because after a tuple is frozen, its xmin
no longer has any meaning. Actually, we will get inconsistent view
results after XID wraparound.

Also, we can see similar similar inconsistency when using sub-transaction
because xmin values do not always monotonically increasing by command
executions.

To fix this, we use a snapshot that taken just before the table is
modified for checking tuple visibility in pre-state table instead of
using xmin and cmin system columns. A new function returning boolean,
ivm_visible_in_prestate, is added, and this is called in WHERE clause
of sub-queries to calculate pre-state table. This function check if a
specified tuple in the post-update table is visible or not using the
snapshot and return true if the tuple is visible.
2022-09-30 11:53:12 +09:00
Yugo Nagata
fbbd86d825
Prepare 1.3 (#27) 2022-09-29 23:20:41 +09:00