Re: BUG #16706: insert into on conflict(pk) do update error violates not-null constraint
От | Tom Lane |
---|---|
Тема | Re: BUG #16706: insert into on conflict(pk) do update error violates not-null constraint |
Дата | |
Msg-id | 1996438.1604952901@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: BUG #16706: insert into on conflict(pk) do update error violates not-null constraint (Vik Fearing <vik@postgresfriends.org>) |
Ответы |
Re: BUG #16706: insert into on conflict(pk) do update error violates not-null constraint
|
Список | pgsql-bugs |
Vik Fearing <vik@postgresfriends.org> writes: > On 11/9/20 4:16 PM, Tom Lane wrote: >> I get >> ERROR: null value in column "name" violates not-null constraint >> DETAIL: Failing row contains (4, null, 6). > That's the complaint. Oh ... it wasn't expressed very well then. I thought the OP was reporting that the not-null constraint wasn't being enforced, which surely *would* be a bug. > I think the issue is the not null constraint is evaluated before the ON > CONFLICT and so there is no chance to "heal" the row by coalescing the > old and new values. Ah. Well, ON CONFLICT is for resolving duplicate-key errors; it's not a get-out-of-jail-free card for every sort of error. I think the right way to handle this example would be with a before-update trigger, which IIRC can modify the row before we apply any table constraint checks. regards, tom lane
В списке pgsql-bugs по дате отправления: