Re: Duplicate key violation on upsert
От | Matt Magoffin |
---|---|
Тема | Re: Duplicate key violation on upsert |
Дата | |
Msg-id | C6A3AA75-38FA-4A8E-9FBD-A9121AE4EE91@msqr.us обсуждение исходный текст |
Ответ на | Re: Duplicate key violation on upsert (Adrian Klaver <adrian.klaver@aklaver.com>) |
Ответы |
Re: Duplicate key violation on upsert
|
Список | pgsql-general |
On 21/03/2020, at 8:10 AM, Adrian Klaver <adrian.klaver@aklaver.com> wrote:The _hyper_1_1931_chunk_da_datum_x_acc_idx index has the same definition as the da_datum_x_acc_idx above (it is defined on a child table). That is, they are both essentially:
UNIQUE, btree (node_id, source_id, ts DESC, jdata_a) WHERE jdata_a IS NOT NULL
The da_datum_pkey index is what the ON CONFLICT cause refers to, so (node_id, ts, source_id) is UNIQUE as well.
Hmm, wonder if you are getting bit by this?:
https://www.postgresql.org/docs/12/sql-insert.html#SQL-ON-CONFLICT
"INSERT with an ON CONFLICT DO UPDATE clause is a “deterministic” statement. This means that the command will not be allowed to affect any single existing row more than once; a cardinality violation error will be raised when this situation arises. Rows proposed for insertion should not duplicate each other in terms of attributes constrained by an arbiter index or constraint.”
— m@
В списке pgsql-general по дате отправления: