Skip to content

Commit

Permalink
Fix segfault with closed primary dimension
Browse files Browse the repository at this point in the history
While it is no longer possible to create this checking return value
of hyperspace_get_open_dimension should still not be neglected.
  • Loading branch information
svenklemm committed Jun 5, 2024
1 parent 577cda4 commit 45befd5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tsl/src/compression/create.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,9 @@ add_time_to_order_by_if_not_included(OrderBySettings obs, ArrayType *segmentby,
bool found = false;

time_dim = hyperspace_get_open_dimension(ht->space, 0);
if (!time_dim)
return obs;

time_col_name = get_attname(ht->main_table_relid, time_dim->column_attno, false);

if (ts_array_is_member(obs.orderby, time_col_name))
Expand Down Expand Up @@ -750,6 +753,9 @@ static bool
update_compress_chunk_time_interval(Hypertable *ht, WithClauseResult *with_clause_options)
{
const Dimension *time_dim = hyperspace_get_open_dimension(ht->space, 0);
if (!time_dim)
return false;

Interval *compress_interval =
ts_compress_hypertable_parse_chunk_time_interval(with_clause_options, ht);
if (!compress_interval)
Expand Down

0 comments on commit 45befd5

Please sign in to comment.