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
Calling match and delete with one variable, and insert with another, results in a TypeQL Error. The insert should be independent of the match and delete.
Environment
OS (where TypeDB server runs): Mac OS 12.6
TypeDB version (and platform): TypeDB Cluster 2.13
TypeDB client: TypeDB Studio 12.13
Reproducible Steps
Steps to create the smallest reproducible scenario:
Create the minimal schema
define
name sub attribute,
value string;
person sub entity,
owns name @key;
Run the minimal query
match $a isa person, has name "alice"; delete $a isa person;
insert $b isa person, has name "bob";
Expected Output
alice to be deleted, if exists. bob to be created.
Actual Output
The TypeQL error is generated
[TQL18] TypeQL Error: None of the variables in 'insert' ('[$b isa person,
has name "bob"]') is within scope of 'match' ('[$a]')
The text was updated successfully, but these errors were encountered:
nikolaimerritt
changed the title
Insert independently of match and delete causes error
Insert independently of match and delete
Nov 23, 2022
I'm encountering the same issue... I'm trying to write a big insert script like this example to populate a database, but I need to be able to run it over and over to iterate on it. So I want it to start with a "delete all data from the database" like those examples do (unless there's an upsert statement, which I couldn't see).
However, if I put match $all isa thing; delete $all isa thing; at the beginning of the .tql file, before a bunch of unrelated insert statements, it gives that error: None of the variables in 'insert' ... is within scope of 'match' ('[$all]').
It seems like you have to use a hack to work around this, by putting a single insert statement immediately following the match $all isa thing; delete $all isa thing;, such as insert $all isa ______, has....; and then you can follow it with as many unrelated inserts as you want. This is an awkward constraint though; I would rather just be able to run the "delete all" and then specify that the following inserts are unrelated and don't need to be tied to the same variables.
Description
Calling
match
anddelete
with one variable, andinsert
with another, results in a TypeQL Error. Theinsert
should be independent of thematch
anddelete
.Environment
Reproducible Steps
Steps to create the smallest reproducible scenario:
Expected Output
alice
to be deleted, if exists.bob
to be created.Actual Output
The TypeQL error is generated
The text was updated successfully, but these errors were encountered: