Re: ON CONFLICT DO NOTHING ignored on bulk insert

2021-05-25 Thread Michael Lewis
Are you wanting to minimize the locking time, or ensure the whole process completes as soon as possible? If the prior, you can insert into a temp table like the real one (which is maybe what pricelistnew is already), delete the rows where they don't have a valid reference, and then insert all

Re: ON CONFLICT DO NOTHING ignored on bulk insert

2021-05-25 Thread Hellmuth Vargas
https://www.postgresql.org/docs/11/sql-insert.html#SQL-ON-CONFLICT "The optional ON CONFLICT clause specifies an alternative action to raising a *unique violation or exclusion constraint violation* error." El mar, 25 de may. de 2021 a la(s) 03:29, Geoff Winkless ( pgsqlad...@geoff.dj) escribió:

Re: ON CONFLICT DO NOTHING ignored on bulk insert

2021-05-25 Thread Geoff Winkless
On Tue, 25 May 2021 at 08:18, Andrus wrote: > Looking for a method to do bulk insert ignoring product foreign key > mismatches. > ON CONFLICT only works with unique constraints, it's not designed for what you're trying to use it for. Geoff

ON CONFLICT DO NOTHING ignored on bulk insert

2021-05-25 Thread Andrus
Hi! Looking for a method to do bulk insert ignoring product foreign key mismatches. Only products which exist in product table should be added to price list. Tried update/truncate/insert     update pricelistnew set timestamp=to_char(now(), 'MMDDHH24MISS');     truncate pricelist;