mirror of
https://github.com/pgvector/pgvector.git
synced 2026-07-13 16:16:56 +08:00
Fixed segmentation fault with COUNT - fixes #9
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
## 0.1.6 (unreleased)
|
||||||
|
|
||||||
|
- Fixed segmentation fault with `COUNT`
|
||||||
|
|
||||||
## 0.1.5 (2021-05-25)
|
## 0.1.5 (2021-05-25)
|
||||||
|
|
||||||
- Reduced memory usage during index creation
|
- Reduced memory usage during index creation
|
||||||
|
|||||||
@@ -51,6 +51,19 @@ ivfflatcostestimate(PlannerInfo *root, IndexPath *path, double loop_count,
|
|||||||
qinfos = deconstruct_indexquals(path);
|
qinfos = deconstruct_indexquals(path);
|
||||||
#endif
|
#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));
|
MemSet(&costs, 0, sizeof(costs));
|
||||||
|
|
||||||
#if PG_VERSION_NUM >= 120000
|
#if PG_VERSION_NUM >= 120000
|
||||||
|
|||||||
@@ -251,6 +251,10 @@ ivfflatgettuple(IndexScanDesc scan, ScanDirection dir)
|
|||||||
{
|
{
|
||||||
Datum value;
|
Datum value;
|
||||||
|
|
||||||
|
/* Safety check */
|
||||||
|
if (scan->orderByData == NULL)
|
||||||
|
elog(ERROR, "cannot scan ivfflat index without order");
|
||||||
|
|
||||||
/* No items will match if null */
|
/* No items will match if null */
|
||||||
if (scan->orderByData->sk_flags & SK_ISNULL)
|
if (scan->orderByData->sk_flags & SK_ISNULL)
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -19,4 +19,10 @@ SELECT * FROM t ORDER BY val <-> (SELECT NULL::vector);
|
|||||||
-----
|
-----
|
||||||
(0 rows)
|
(0 rows)
|
||||||
|
|
||||||
|
SELECT COUNT(*) FROM t;
|
||||||
|
count
|
||||||
|
-------
|
||||||
|
5
|
||||||
|
(1 row)
|
||||||
|
|
||||||
DROP TABLE t;
|
DROP TABLE t;
|
||||||
|
|||||||
@@ -10,5 +10,6 @@ INSERT INTO t (val) VALUES ('[1,2,4]');
|
|||||||
|
|
||||||
SELECT * FROM t ORDER BY val <-> '[3,3,3]';
|
SELECT * FROM t ORDER BY val <-> '[3,3,3]';
|
||||||
SELECT * FROM t ORDER BY val <-> (SELECT NULL::vector);
|
SELECT * FROM t ORDER BY val <-> (SELECT NULL::vector);
|
||||||
|
SELECT COUNT(*) FROM t;
|
||||||
|
|
||||||
DROP TABLE t;
|
DROP TABLE t;
|
||||||
|
|||||||
Reference in New Issue
Block a user