From: | Andrus <kobruleht2(at)hot(dot)ee> |
---|---|
To: | Michael Lewis <mlewis(at)entrata(dot)com> |
Cc: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Duplicate key error |
Date: | 2021-03-04 19:46:32 |
Message-ID: | 516197f2-545a-db36-3f5c-caa766c63a0c@hot.ee |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hi!
>I just meant a regular update (which might impact 0 rows) and then
insert (not exists) like you are doing already.
This causes duplicate key exception if other process adds same row to
table at same time.
>
> >--transaction still ways. Should manual locking used or is there
> better method.
> >I don't follow what you mean.
Allow access to this table for single transaction only. Wait for
exclusive lock , do update/insert, release exclusive lock.
Andrus.
From | Date | Subject | |
---|---|---|---|
Next Message | Andrus | 2021-03-05 10:13:27 | Log files polluted with permission denied error messages after every 10 seconds |
Previous Message | Michael Lewis | 2021-03-04 19:23:11 | Re: Duplicate key error |