You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The value of let statements is instantly lost once they have been executed. Running
-- Define the parameter
LET $name = "tobie";
And then
-- Use the parameter
CREATE person SET name = $name;
results in the name field not being set:
> LET $name = "tobie";
[{"time":"17.363µs","status":"OK","result":null}]
> CREATE person:3 SET name = $name;
[{"time":"116.22µs","status":"OK","result":[{"id":"person:3"}]}]
However interestingly copying both statements together into the repl works as expected.
Steps to reproduce
Run
> LET $name = "tobie";
[{"time":"17.363µs","status":"OK","result":null}]
> CREATE person:3 SET name = $name;
[{"time":"116.22µs","status":"OK","result":[{"id":"person:3"}]}]
Currently the REPL opens a new connection to the database for each submitted query, and therefore all context between queries is reset.
We'll be changing this really soon so that it connects over the WebSocket connection instead, meaning that all context is kept between submitted queries.
That should then fix this issue.
tobiemh
changed the title
Bug: LET statements do not work
Bug: LET statement variables do not stay across queries in the CLI REPL
Aug 20, 2022
Describe the bug
The value of let statements is instantly lost once they have been executed. Running
And then
results in the name field not being set:
However interestingly copying both statements together into the repl works as expected.
Steps to reproduce
Run
Expected behaviour
The value is stored in the variable.
SurrealDB version
surreal 1.0.0-beta.6 for linux on x86_64
Contact Details
peteole2707@gmail.com
Is there an existing issue for this?
Code of Conduct
The text was updated successfully, but these errors were encountered: