Skip to content

Commit

Permalink
fix(client) Change _applyNonDeleteOperation to use pk column for crea…
Browse files Browse the repository at this point in the history
…ting the `ON CONFLICT` statement (#1244)

Previous version prior to PG support didn't reference columns in the `ON
CONFLICT`:https://github.com/electric-sql/electric/blame/c8e698148d4082d2c3fc1f081d410434f228b01b/clients/typescript/src/satellite/process.ts#L1631

I suspect this bug was inherited from the Tauri Linearlite demo as it
only had PKs as "id"
  • Loading branch information
samwillis committed May 9, 2024
1 parent 6a746d9 commit ebd2cb9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/spicy-items-poke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"electric-sql": patch
---

Fix a bug with Postgres client sync so that pk columns for creating the ON CONFLICT statement are correct when applying an incoming transaction.
2 changes: 1 addition & 1 deletion clients/typescript/src/satellite/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1621,7 +1621,7 @@ export class SatelliteProcess implements Satellite {
qualifiedTableName,
columnNames,
columnValues,
['id'],
Object.keys(primaryKeyCols),
updateColumnStmts,
updateColumnStmts.map((col) => fullRow[col])
)
Expand Down

0 comments on commit ebd2cb9

Please sign in to comment.