We have some debug messages that are printed as notices, but are more
suitable to have at `DEBUG1` level. This commit removes a notice about
indexes being added and turns it into a `DEBUG1` notice.
This change adds a compiler-agnostic annotation for fall-throughs in
switch statements. The definition is put in `annotations.h`, which can
be expanded to hold definitions for similar functionality in the
future.
The `clang` compiler (as of version 12) seems to have have dropped
support for the previous comment-based annotations to allow
fall-throughs in favor of native annotations or GCC-style attributes.
This patch changes the update test to use the same checks
between clean / updated install and dumped/restored install.
Previously only a small subset of the checks would be run against
the updated instance and most of the tests would only run against
the dumped and restored container.
Starting with PG11 heap_open/_close is a macro that redirects to
table_open/_close. In PG13 those compatibility macros are being
removed so we have to use the actual function.
PL/pgSQL is installed by default starting with PostgreSQL 9.0 so
the parameter is not needed, additionally the parameter will
throw an error on PG13 pg_regress.
Commit 8e1e6036 changed chunk compression to disable autovacuum
on compressed chunks but did not apply the setting to chunks
compressed before that change. So this patch changes chunks
compressed with previous version to disable autovacuum as well.
As part of the 2.0 continous aggregate changes, we are removing the
continuous_aggs_completed_threshold table. However, this may result
in currently running aggregates being considered complete even if
their completed threshold hadn't reached the invalidation threshold.
This change fixes this by adding an entry to the invalidation log
for any such aggregates.
Fixes#2314
Since invalidations are inclusive in both ends, adjacent invalidations
can be merged. However, adjacency wasn't accounted for when merging
invalidations, which meant that a refresh could leave more
invalidations in the log than strictly necessary. Note that this
didn't otherwise affect the correctness of a refresh.
When setting up an index scan for invalidations, a table attribute
number was used instead of the corresponding index attribute
number. While the attribute numbers happened to be the same, it isn't
future proof to use the wrong attribute reference.
Before this commit, grants on continuous aggregates were not propagated
to the materialized hypertable, direct view, and partial view. With
this commit, grants on a continuous aggregate is propagated.
Fixes#2413
After recent refactoring the refresh window arguments are not used in
many invalidation functions. This fixes the code and removes unused
arguments to avoid future confusions.
This patch fixes the format strings used to construct object names
in tests. The format strings used in those tests would break when
object names are involved that require quoting.
Implements support for changing the owner of the continuous aggregate.
This will change the owner of the materialized hypertable, the
user view, the partial view, and the direct view.
Fixes#2414Fixes#1277
This change removes the catalog options `refresh_lag`,
`max_interval_per_job` and `ignore_invalidation_older_than`, which are
no longer used.
Closes#2396
To create a chunk in a hypertable, it is currently necessary to be the
owner of the hypertable of the chunk. If a user has insert privileges
only, it will fail with an error message, which causes problems when
inserting data into distributed hypertables since the user cannot
create new chunks.
This commit changes this and only requires that the user has insert
privileges on the hypertable of the chunk for allowing creation of a
new chunk.
Closes#2393
During refactoring continuous aggregates some function defintions
for functions that got removed were not removed from the header
file. Additionally a few other header files had function definitions
that no longer had an implementation or macros that were not used.
Remove ts_dimension_info_create_open_interval_usec function because
it was no longer used. This patch also moves the add_dimension record
attribute numbers into the c file because it does not need to be
exported.
The functions find_em_expr_for_rel and ts_find_em_expr_for_rel are
identical. This patch removes find_em_expr_for_rel and changes all
call-sites to use ts_find_em_expr_for_rel.
The recently added test for hypertable detection used compression
which is not available in ApacheOnly tests so we move that test
to regresscheck-t. Additionally we move the other test in
plan_hypertable_cache to plan_expand_hypertable to reduce the number
of tests.
This change checks for ownership of the user view when refreshing a
continuous aggregate (it's assumed the other objects have the same
owner). This mimics the checks done when refreshing a regular
materialized view.
Fixes#2408
Rename the `refresh_interval` field in
`timescaledb_information.continuous_aggregate` view to match the
parameter name in `add_continuous_aggregate_policy`.
The is_compressed column for timescaledb_information.chunks
view is defined as TEXT instead of BOOLEAN
as true and false were specified using string literals.
Fixes#2409
This patch changes the time_bucket validation to constify the width
argument so any immutable expression will be allowed. This change
allows continuous aggregates on hypertables with int8 time dimension
without requiring a workaround from a user to get the time_bucket
call accepted.
During migration of CI from travis to github actions running
postgres regression test suite was missed. This patch changes
our regression workflow to run postgres regression test suite
as well.
The new refresh functionality for continuous aggregates replaces the
old materializer, which means some code is no longer used and should
be removed.
Closes#2395
This change cleans up and removes duplicate code for internal lookups
of continuous aggregates. A number of related error messages have also
been cleaned up and made conformant with the error style guide.
Early version of PG11 produces slightly different output for isolation
tests. Thus the affected tests are ignored.
continuous_aggs_concurrent_refresh is one of them and this commit adds
it to the ignored test list.
Stats for policies are exposed via
the policy_stats view. Remove continuous aggregate
stats view - the thresholds exposed via this
view are not relevant with the new API.
Removes options refresh_lag, max_interval_per_job and
ignore_invalidation_older_than from continuous aggregate creation with
CREATE MATERIALIZED VIEW, since they are not related this statement
any more. They are already replaced with the corresponding options in
add_continuous_aggregate_policy.
This commit removes only options, while the options are still stored
in the catalog and need to be removed from there in a separate PR.
If a continuous aggregate is created using `CREATE MATERIALIZED VIEW`
using the `WITH DATA` option, it will fail with a segmentation fault if
executed inside a transaction or block. This is because starting a new
transaction in the middle of the statement will reset the SPI stack.
This commit fixes this by raising an error if `CREATE MATERIALIZED
VIEW` is not executed on top-level and `WITH DATA` is used either
directly or indirectly.
Closes#2371
This change filters materialized hypertables from the hypertables
view, similar to how internal compression hypertables are
filtered.
Materialized hypertables are internal objects created as a side effect
of creating a continuous aggregate, and these internal hypertables are
still listed in the continuous_aggregates view.
Fixes#2383