mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-04 03:30:56 +08:00
Fixed segmentation fault with COUNT - fixes #9
This commit is contained in:
@@ -51,6 +51,19 @@ ivfflatcostestimate(PlannerInfo *root, IndexPath *path, double loop_count,
|
||||
qinfos = deconstruct_indexquals(path);
|
||||
#endif
|
||||
|
||||
/* Never use index without order */
|
||||
if (path->indexorderbys == NULL)
|
||||
{
|
||||
*indexStartupCost = 1.0e10;
|
||||
*indexTotalCost = 1.0e10;
|
||||
*indexSelectivity = 0;
|
||||
*indexCorrelation = 0;
|
||||
#if PG_VERSION_NUM >= 100000
|
||||
*indexPages = 0;
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
MemSet(&costs, 0, sizeof(costs));
|
||||
|
||||
#if PG_VERSION_NUM >= 120000
|
||||
|
||||
@@ -251,6 +251,10 @@ ivfflatgettuple(IndexScanDesc scan, ScanDirection dir)
|
||||
{
|
||||
Datum value;
|
||||
|
||||
/* Safety check */
|
||||
if (scan->orderByData == NULL)
|
||||
elog(ERROR, "cannot scan ivfflat index without order");
|
||||
|
||||
/* No items will match if null */
|
||||
if (scan->orderByData->sk_flags & SK_ISNULL)
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user