Closed maydanw closed 5 months ago
After following the steps above, I've got the results below:
I believe these results confirm the theory, that the match clause in the insert query in the file 07 matches two results; hence the insert clause is executed twice, inserting two relations: $purchase1_ram (provider: $supplier1, provided_part: $ram) isa purchased, has purchase_date 2024-01-11, has quantity 400, has price 30000.00;
. That explains the duplication of the relation.
That behavior is expected and documented: https://development.typedb.com/docs/typeql/data/insert#_matching_in_an_insert_query
This was the problem I had. From my understanding, the reason was that 2 of the parts in the MATCH parts had the same name but different serial numbers. This causes the whole block to run twice and enter the purchase relation twice even due it was defined only once. There is still something confusing there as I defined the insertion once and there is only one RAM entity but for the specific case at hand, I changed it to work with the serial numbers, and the issue was solved.
[image: Mailtrack] https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality11& Sender notified by Mailtrack https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality11& 16.01.24, 15:20:59
On Tue, 16 Jan 2024 at 13:35, Vladimir Izmalkov @.***> wrote:
After following the step above, I've got the results below:
Screenshot.2024-01-16.at.11.21.44.png (view on web) https://github.com/vaticle/typedb/assets/48120135/f7560dd5-f47c-4a2e-919b-e9d0659f44cd Screenshot.2024-01-16.at.11.21.08.png (view on web) https://github.com/vaticle/typedb/assets/48120135/add91058-0cb2-48a6-aa13-d88f98075215
I believe those results confirm the theory, that the match clause in the insert query in the file 07 matches two results, hence the insert clause is executed twice, inserting two relations: $purchase1_ram (provider: $supplier1, provided_part: $ram) isa purchased, has purchase_date 2024-01-11, has quantity 400, has price 30000.00;. That explains the duplication of the relation. That behavior is expected and documented: https://development.typedb.com/docs/typeql/data/insert#_matching_in_an_insert_query
— Reply to this email directly, view it on GitHub https://github.com/vaticle/typedb/issues/6970#issuecomment-1893568092, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIPXPISW6ONPK4WVKSXUVDYOZQZNAVCNFSM6AAAAABB4TBMP2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJTGU3DQMBZGI . You are receiving this because you authored the thread.Message ID: @.***>
Closing since it is resolved.
Description
When inserting data I see duplicated insertions
Environment
Reproducible Steps
Set up files.zip
Extract the zip file
In TypeDB Studio create a new database and set to schema writing state
Run Files 01, 03, 04, 05
Set to writing data state and add 02, 06, 07
Watch closely at 07 and specifically at adding the RAM
Execute
Unexpected result You will notice there are two different purchases of RAM even yet only one was inserted
Expected result
Single purchase
Additional information
Relevant logs from TypeDB or Driver: