little_pger
little_pger copied to clipboard
upsert does not support composite primary keys
If we have a table with a composite primary key:
CREATE TABLE items (
x INT,
y INT,
value INT,
PRIMARY KEY (x, y)
);
pg.upsert('items', values={'x': 1, 'y': 2, 'value': 44})
leads to the following error:
there is no unique or exclusion constraint matching the ON CONFLICT specification
because _real_upsert
just fetches one primary key.
I'm sorry, for some reason I didn't see any notification for your issue. Are you still using the library, and would that feature make your life simpler and better (in a small way of course)? If so, I'd be happy to implement it!
Yeah GitHub notifications are weird. I have since moved on to use my own little Postgres helper methods, so I no longer personally need this feature ... thanks for the offer anyway!