data modifying WITH seems to drop rows in cascading updates -- bug?

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Marko Tiikkaja <marko(at)joh(dot)to>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: data modifying WITH seems to drop rows in cascading updates -- bug?
Date: 2019-08-24 08:26:36
Message-ID: CAHyXU0zkt6KssjEsWd+AZ7mfUC42h+bewOq-VLv7mn1DHkXmoQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Saturday, August 24, 2019, Marko Tiikkaja <marko(at)joh(dot)to> wrote:

> On Sat, Aug 24, 2019 at 6:33 AM Merlin Moncure <mmoncure(at)gmail(dot)com> wrote:
>
>> Right. Shame on me for not checking the docs before posting. Simply
>> stated, this is undefined behavior.
>>
>
> Nah; it's defined, yet unpredictable behavior. Still worth half the
> points, I guess.
>

Lack of prediction on outputs is a class of undefined behavior. If a
program is left in unknown state (including results returned to caller)
this meets the classic definition of undefined. I realize this is purely
semantic pedantry but in language design these distinctions are important
and fun to discuss.

Undefined behavior is good. It allows for future refinements of the model
and frees the caller from expectations against the result; if some fast,
clever way of managing these cases is somehow innovated the behavior can be
defined later without breaking compatibility.

FYI: this thread exists as it was turned up during the process of teaching
yet another convert the cooler stuff with postgres and he's now getting
into wCTE. I visibly saw the light bulb go off...he's ours now. I'm a fan
of your work

merlin

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Georg Sauthoff 2019-08-24 08:44:20 Re: BUG #15961: psql should be able to read password from stdin
Previous Message Marko Tiikkaja 2019-08-24 07:08:42 Re: data modifying WITH seems to drop rows in cascading updates -- bug?