Commit 87f6f1d
committed
fix: use record cast for fn::node_info() parameter handling
Fixed fn::node_info() to properly handle SurrealDB record IDs using
<record> type casting instead of type::thing() construction.
Root cause: SurrealDB stores IDs as record types (nodes:⟨uuid⟩) and when
passed as string parameters, they need to be cast back to record type for
FROM clauses to work.
Fix:
- Build full record ID string: "nodes:uuid" (handles both formats)
- Use <record> cast: FROM ONLY <record> $full_id
- Return $res directly (FROM ONLY returns single object, not array)
This handles:
1. Full record ID string: "nodes:0002cb76-..." → used as-is
2. Just UUID: "0002cb76-..." → prepended with "nodes:"
3. Record cast: <record> converts string to proper Thing type
Test with:
SELECT fn::node_info('0002cb76-bdea-4461-b489-cc76476ee863');
SELECT fn::node_info('nodes:0002cb76-bdea-4461-b489-cc76476ee863');1 parent 7d4f4ac commit 87f6f1d
1 file changed
+7
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
294 | 294 | | |
295 | 295 | | |
296 | 296 | | |
297 | | - | |
298 | | - | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
299 | 300 | | |
300 | | - | |
| 301 | + | |
301 | 302 | | |
302 | 303 | | |
| 304 | + | |
303 | 305 | | |
304 | 306 | | |
305 | 307 | | |
| |||
312 | 314 | | |
313 | 315 | | |
314 | 316 | | |
315 | | - | |
316 | | - | |
| 317 | + | |
317 | 318 | | |
318 | | - | |
| 319 | + | |
319 | 320 | | |
320 | 321 | | |
321 | 322 | | |
| |||
0 commit comments