This is what I want to achieve:
dg/test> create item:ulid() set index = 1;
[
{
id: item:01HGE6SJM83WQYAWE2DZJV389D,
index: 1
}
]
dg/test> create item:ulid() set index = 12
[
{
id: item:01HGE6SKP0YM6X1PT0QTSKW6PD,
index: 12
}
]
dg/test> create item:ulid() set index = 22;
[
{
id: item:01HGE6SPXM4Y7007SP7XX1Q0CK,
index: 22
}
]
dg/test> select * from item:01HGE6SKP0YM6X1PT0QTSKW6PD..;
[
{
id: item:01HGE6SKP0YM6X1PT0QTSKW6PD,
index: 12
},
{
id: item:01HGE6SPXM4Y7007SP7XX1Q0CK,
index: 22
}
]
dg/test> let $seq="01HGE6SKP0YM6X1PT0QTSKW6PD";
[]
dg/test> select * from item:$seq; --< Parse error: Failed to parse query at line 1 column 19 expected one of WITH, WHERE, SPLIT, GROUP, ORDER, LIMIT, START, FETCH, VERSION, TIMEOUT, PARELLEL, or EXPLAIN
|
1 | select * from item:$seq;
As you can see I cannot use $seq
like this way.
I also tried using type::thing
but I don't know how to use it with range ("..")
dg/test> select * from type::thing("item", $seq);
[
{
id: item:01HGE6SKP0YM6X1PT0QTSKW6PD,
index: 12
}
]
dg/test> select * from type::thing("item", $seq)..; --< Parse error: Failed to parse query at line 1 column 41 expected an identifier
|
1 | select * from type::thing("item", $seq)..;
| ^
Any suggestions would be appreciated.
Maybe I should use a simple WHERE id > $seq
. However range queries are very efficient and I'm not sure about the WHERE
clause performance in this scenario.
This appears to be a bug, as what you wrote here would otherwise be the correct approach.
select * from type::thing("item", $seq)..
Would it be possible for you open this as bug in our repo? https://github.com/surrealdb/surrealdb/issues