From: | Simon Riggs <simon(dot)riggs(at)enterprisedb(dot)com> |
---|---|
To: | Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
Cc: | Andres Freund <andres(at)anarazel(dot)de>, Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>, Zhihong Yu <zyu(at)yugabyte(dot)com>, Daniel Westermann <dwe(at)dbi-services(dot)com>, Amit Langote <amitlangote09(at)gmail(dot)com>, Justin Pryzby <pryzby(at)telsasoft(dot)com>, Japin Li <japinli(at)hotmail(dot)com>, Erik Rijkers <er(at)xs4all(dot)nl>, Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec> |
Subject: | Re: support for MERGE |
Date: | 2022-03-10 15:48:54 |
Message-ID: | CANbhV-HgNB805QSikNTVSeFOV_jpfGokQpbboQjHntzo9auXRw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Sun, 27 Feb 2022 at 17:35, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote:
> > > + /*
> > > + * Project the tuple. In case of a partitioned table, the
> > > + * projection was already built to use the root's descriptor,
> > > + * so we don't need to map the tuple here.
> > > + */
> > > + actionInfo.actionState = action;
> > > + insert_slot = ExecProject(action->mas_proj);
> > > +
> > > + (void) ExecInsert(mtstate, rootRelInfo,
> > > + insert_slot, slot,
> > > + estate, &actionInfo,
> > > + mtstate->canSetTag);
> > > + InstrCountFiltered1(&mtstate->ps, 1);
> >
> > What happens if somebody concurrently inserts a conflicting row?
>
> An open question to which I don't have any good answer RN.
Duplicate rows should produce a uniqueness violation error in one of
the transactions, assuming there is a constraint to define the
conflict. Without such a constraint there is no conflict.
Concurrent inserts are checked by merge-insert-update.spec, which
correctly raises an ERROR in this case, as documented.
Various cases were not tested in the patch - additional patch
attached, but nothing surprising there.
ExecInsert() does not return from such an ERROR, so the code fragment
appears correct to me.
--
Simon Riggs http://www.EnterpriseDB.com/
Attachment | Content-Type | Size |
---|---|---|
new_insert_tests_for_merge.patch | application/octet-stream | 1.0 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2022-03-10 15:53:49 | Re: ltree_gist indexes broken after pg_upgrade from 12 to 13 |
Previous Message | Andrew Dunstan | 2022-03-10 15:43:06 | Re: ltree_gist indexes broken after pg_upgrade from 12 to 13 |