-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
Hi. I've discussed this in discord with tanmaig aka @coco98.
I have the following table structure.
A tweet can contain many symbols and a symbol can be in many tweets. Classic many to many relationship.
The problem. If I try to upsert anything to an existing row in the symbol table graphql wants to change the primary key which will break the relationship to tweets.
mutation upsert_symbol {
insert_symbol(
objects: [{ symbol: "INTC", is_stock: true, is_crypto: false }]
on_conflict: { constraint: symbol_symbol_key, action: update }
) {
returning {
id
symbol
}
affected_rows
}
}In this case, if INTC already exists and is_crypto is being changed then the row is deleted and recreated with a new primary key. 😳
The same thing happens even if [{ symbol: "INTC", is_stock: true, is_crypto: false }] already have the same values.
@coco98 and @0x777 have discussed and plan on releasing a fix shortly.
They asked me to make this issue so they have something to attach to the PR.
Thanks!
Jeremy