Skip to content

Commit 4b3e7e7

Browse files
committed
fix random row selection query to have db name
1 parent 5eeba43 commit 4b3e7e7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libsql-sqlite3/src/vectordiskann.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -574,8 +574,8 @@ static int diskAnnSelectRandomShadowRow(const DiskAnnIndex *pIndex, u64 *pRowid)
574574

575575
zSql = sqlite3MPrintf(
576576
pIndex->db,
577-
"SELECT rowid FROM \"%w\".%s LIMIT 1 OFFSET ABS(RANDOM()) %% MAX((SELECT COUNT(*) FROM %s), 1)",
578-
pIndex->zDbSName, pIndex->zShadow, pIndex->zShadow
577+
"SELECT rowid FROM \"%w\".%s LIMIT 1 OFFSET ABS(RANDOM()) %% MAX((SELECT COUNT(*) FROM \"%w\".%s), 1)",
578+
pIndex->zDbSName, pIndex->zShadow, pIndex->zDbSName, pIndex->zShadow
579579
);
580580
if( zSql == NULL ){
581581
rc = SQLITE_NOMEM_BKPT;

0 commit comments

Comments
 (0)