Commit 399e7bf
committed
fix: use SET instead of CONTENT in UPSERT to avoid overwriting record IDs
Critical fix for SurrealDB 2.x: Changed UPSERT queries to use SET clause
instead of CONTENT to prevent attempting to overwrite built-in record ID
fields with string values.
Root cause: CONTENT $doc includes the id field from the Rust struct
(which is a String), and tries to overwrite the record's id field (which
is a built-in record type in SurrealDB). This causes errors or data
corruption.
Fixed queries:
1. UPSERT_NODES_QUERY: Changed to SET with explicit field list (excludes id)
2. UPSERT_EDGES_QUERY: Changed to SET (excludes id, converts from/to to records)
3. UPSERT_SYMBOL_EMBEDDINGS_QUERY: Changed to SET with explicit field list
Pattern:
Before: UPSERT type::thing('nodes', $doc.id) CONTENT $doc;
After: UPSERT type::thing('nodes', $doc.id) SET field1 = $doc.field1, ...;
Benefits:
- Record ID stays as proper record type
- No attempt to overwrite id with string
- Explicit field mapping shows what's being stored
- Compatible with SurrealDB 2.x record ID system
This should eliminate the "Failed to read SurrealDB node count" warnings
during indexing.1 parent 0a79d3e commit 399e7bf
1 file changed
+43
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1367 | 1367 | | |
1368 | 1368 | | |
1369 | 1369 | | |
1370 | | - | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
1371 | 1391 | | |
1372 | 1392 | | |
1373 | 1393 | | |
1374 | 1394 | | |
1375 | 1395 | | |
1376 | 1396 | | |
1377 | | - | |
1378 | | - | |
1379 | | - | |
1380 | | - | |
1381 | | - | |
1382 | | - | |
1383 | | - | |
1384 | | - | |
1385 | | - | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
1386 | 1404 | | |
1387 | 1405 | | |
1388 | 1406 | | |
1389 | 1407 | | |
1390 | 1408 | | |
1391 | 1409 | | |
1392 | | - | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
1393 | 1425 | | |
1394 | 1426 | | |
1395 | 1427 | | |
| |||
0 commit comments