pg_ivm/sql
Yugo Nagata 5b8b2f0a82
Fix targetlist of subquery substituting modified table (#117)
A RTE of modified table in the view definition query is substituted
by a subquery representing a delta table or a pre-update state table
during view maintenance. After this rewrite, Var that used to reference
the table column should become to references the corresponding column
in the subquery targetlist. Previously, the targetlist contained only
existing columns of the table. This was not a problem as long as the
table didn't have any dropped column because varattnos in the query
tree  was identical to resno of the targetlist. However, if the table
has a dropped column, we cannot assume this correspondence, so an error
like the following occurred in that situation.

ERROR: could not find attribute 43 in subquery targetlist

To fix it,  put "null" as a dummy value at the position in the targetlist
of a dropped column so that varattnos in the query tree is identical to
resno of the targetlist. We would also able to fix this by walking the
query tree to rewrite varattnos, but crafting targetlist is more simple
and reasonable.

Issue #85
2025-02-20 12:58:03 +09:00
..
create_immv.sql Change the schema from pg_catalog to pgivm (#116) 2025-02-17 12:07:21 +09:00
pg_ivm.sql Fix targetlist of subquery substituting modified table (#117) 2025-02-20 12:58:03 +09:00
refresh_immv.sql Change the schema from pg_catalog to pgivm (#116) 2025-02-17 12:07:21 +09:00