-
Notifications
You must be signed in to change notification settings - Fork 19
Description
It'd be more flexible and simpler to pass to postgres the list of columns or index name itself. But I guess you'd want to continue supporting the old way, too, so it wouldn't actually simplify anything.
I noticed this while adding something similar in telsasoft-specific db layer. We use unique indexes but not primary keys. There may be other reasons why we wouldn't use DB.insert(), too, but it'd be nice if this supported non-primary keys, and also multiple combinations of unique indexes.
Edit: of course I mean DB.upsert()
Edit: also, ON CONFLICT DO NOTHING needs no pkey nor columns nor unique index at all (even though in my experience that may be a bad idea since if an unique index is missing it causes no error)
Edit: also, ON CONFLICT allows WHERE clauses in two different places (in the ON CONFLICT and in the DO UPDATE SET). And some other syntactic cases. But, I'm actually using the where clauses now, but some of these are maybe "pie in the sky" and maybe of maybe marginal value.