Add the missing variables to the finalization view of Continuous
Aggregates and the corresponding columns to the materialization table.
Cover the case of targets that contain Aggref nodes and Var nodes
that are outside of the Aggref nodes at the same time.
Stop rebuilding the Continuous Aggregate view with ALTER MATERIALIZED
VIEW. Attempt to repair the view at post-update time instead, and fail
gracefully if it is not possible to do so without raw hypertable schema
or data modifications.
Stop rebuilding the Continuous Aggregate view when switching realtime
aggregation on and off. Instead, manipulate the User View by either:
1. removing the UNION ALL right-hand side and the WHERE clause when
disabling realtime aggregation
2. adding the Direct View to the right of a UNION ALL operator and
defining WHERE clauses with the relevant watermark checks when
enabling realtime aggregation
Fixes#3898
Smoke tests where missing critical files and some tests had changed
since last run and did not handle update smoke tests, so fixing all
necessary issues.
The update smoke test script can be used to test that an extension
works correctly. It will run the normal update tests, but do it against
a single server.
It also makes some minor refactorings of the update tests to make it
possible to run the tests against different versions of the server and
also support the smoke tests where some features cannot be tested.
In order to implement repair tests, changes are made to the
`constraint_check` table to simulate a broken dependency, which
requires the constraints on that table to be dropped. This means that
the repair runs without constraints, and a bug in the update test could
potentially not get caught.
This commit fixes this by factoring out the repair tests from the
update tests and run them as a separate pass. This means that the
contraints are not dropped in the update tests and bugs there will be
caught.
In addition, some bash functions are factored out into a separate file
to avoid duplication.
In order to support smoke-testing with a single server, the update
tests are refactored to not require a `postgres` user with full
privileges.
To support both running smoke tests and update tests, the following
changes where made:
- Database creation code was factored out of tests and is only executed
for update tests.
- Since the default for `docker_pgscript` was to use the `postgres`
database and the database creation code also switched database to
`single` as part of the exection, the default of `docker_pgscript` is
now changed to `single`.
- Parts of tests that changes roles during execution was removed since
it is more suitable for a regression test. Some `GRANT` statements
were kept for the update tests since they test that non-superuser
privileges are propagated correctly.
- Operations that require escalated privileges are factored out into
support functions that execute the original code for update tests and
are no-ops for smoke tests.
- A dedicated `test_update_smoke` script was added that can run a smoke
test against a single server.