node-etl icon indicating copy to clipboard operation
node-etl copied to clipboard

Postgres Upsert - Unique Field Support

Open valeeum opened this issue 4 years ago • 0 comments

Currently, postgres upsert only takes primary keys into consideration for generating ON CONFLICT statements. It would be helpful to also be able to upsert against unique fields. One solution would be to be able to pass in 'pkeys' via options.

Current code:
if (this.upsert) this.pkeys = this.getPrimaryKeys();

Suggested Change: if (this.upsert) this.pkeys = this.options.pkeys ? Promise.resolve(this.options.pkeys) : this.getPrimaryKeys();

valeeum avatar Dec 13 '20 07:12 valeeum