mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-17 19:13:16 +08:00
Check for NULL before dereferencing variable
Move the NULL-check in continuous_agg_execute_materialization before the first dereferencing of the variable.
This commit is contained in:
parent
59c04767a6
commit
8f25517d4b
@ -886,6 +886,10 @@ continuous_agg_execute_materialization(int64 bucket_width, int32 hypertable_id,
|
|||||||
SchemaAndName materialization_table_name;
|
SchemaAndName materialization_table_name;
|
||||||
Cache *hcache = ts_hypertable_cache_pin();
|
Cache *hcache = ts_hypertable_cache_pin();
|
||||||
Hypertable *raw_table = ts_hypertable_cache_get_entry_by_id(hcache, hypertable_id);
|
Hypertable *raw_table = ts_hypertable_cache_get_entry_by_id(hcache, hypertable_id);
|
||||||
|
|
||||||
|
if (raw_table == NULL)
|
||||||
|
elog(ERROR, "can only materialize continuous aggregates on a hypertable");
|
||||||
|
|
||||||
Oid time_col_type =
|
Oid time_col_type =
|
||||||
ts_dimension_get_partition_type(hyperspace_get_open_dimension(raw_table->space, 0));
|
ts_dimension_get_partition_type(hyperspace_get_open_dimension(raw_table->space, 0));
|
||||||
InternalTimeRange new_materialization_range = {
|
InternalTimeRange new_materialization_range = {
|
||||||
@ -905,9 +909,6 @@ continuous_agg_execute_materialization(int64 bucket_width, int32 hypertable_id,
|
|||||||
range_check(new_invalidation_range, bucket_width);
|
range_check(new_invalidation_range, bucket_width);
|
||||||
range_check(new_materialization_range, bucket_width);
|
range_check(new_materialization_range, bucket_width);
|
||||||
|
|
||||||
if (raw_table == NULL)
|
|
||||||
elog(ERROR, "can only materialize continuous aggregates on a hypertable");
|
|
||||||
|
|
||||||
if (materialization_table == NULL)
|
if (materialization_table == NULL)
|
||||||
elog(ERROR, "can only materialize continuous aggregates to a hypertable");
|
elog(ERROR, "can only materialize continuous aggregates to a hypertable");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user