mirror of
https://github.com/timescale/timescaledb.git
synced 2025-05-17 19:13:16 +08:00
Fix planner distributed table count
The check for a distributed hypertable was done after ht had been changed to the compressed hypertable potentially leading to miscount or even segfault when the cache lookup for the compressed hypertable returned NULL.
This commit is contained in:
parent
d9e4a71af3
commit
727a0278fd
3
.unreleased/pr_6113
Normal file
3
.unreleased/pr_6113
Normal file
@ -0,0 +1,3 @@
|
||||
Fixes: #6113 Fix planner distributed table count
|
||||
|
||||
Thanks: @symbx for reporting a crash when selecting from empty hypertables
|
@ -388,19 +388,18 @@ preprocess_query(Node *node, PreprocessQueryContext *context)
|
||||
query->rowMarks == NIL && rte->inh)
|
||||
rte_mark_for_expansion(rte);
|
||||
|
||||
if (hypertable_is_distributed(ht))
|
||||
{
|
||||
context->num_distributed_tables++;
|
||||
}
|
||||
|
||||
if (TS_HYPERTABLE_HAS_COMPRESSION_TABLE(ht))
|
||||
{
|
||||
int compr_htid = ht->fd.compressed_hypertable_id;
|
||||
|
||||
/* Also warm the cache with the compressed
|
||||
* companion hypertable */
|
||||
ht = ts_hypertable_cache_get_entry_by_id(hcache, compr_htid);
|
||||
Assert(ht != NULL);
|
||||
}
|
||||
|
||||
if (hypertable_is_distributed(ht))
|
||||
{
|
||||
context->num_distributed_tables++;
|
||||
ts_hypertable_cache_get_entry_by_id(hcache, compr_htid);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user