Re:Re: BUG #17036: generated column cann't modifyed auto when update

From: 德哥 <digoal(at)126(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re:Re: BUG #17036: generated column cann't modifyed auto when update
Date: 2021-05-27 09:24:44
Message-ID: 574cb2f7.4da8.179ad23f309.Coremail.digoal@126.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Thank you Tom Lane for your reply. I think your explanation is very clear.

So can we talk about the use of volatile or stable functions in generated columns and if there are actual business scenarios, why not design the functionality from the perspective of the scenarios instead of the scenarios?

--

公益是一辈子的事,I'm Digoal,Just Do It.

At 2021-05-27 11:09:00, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>=?GBK?B?tcK45w==?= <digoal(at)126(dot)com> writes:
>> The generated column can be used to automatically generate the modified timestamp of a tuple, but PG 12 currently supports this scenario. PG 13 has started to change its behavior, which makes our application need to be modified. This is the first time I have ever seen a PG upgrade kill a nice feature.
>
>You have been told several times already that this is not a "feature".
>The point of the restriction that GENERATED expressions be immutable
>is that the implementation need not recompute them during UPDATE
>(if none of their input columns changed).
>
>If v12 failed to exploit that fully, that's more a bug in v12 than
>it is in versions that do exploit it.
>
>If you need to update a column during every update, the best way
>to do that is with a BEFORE INSERT OR UPDATE trigger.
>
>I will also state categorically that lying about the mutability
>of a function is a technique that will bite you on the rear, and
>you will get no sympathy when it does. If it does what you want
>in version N, fine, but don't whine when it breaks in N+1.
>
> regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Dmitry Dolgov 2021-05-27 10:53:28 Re: XX000: unknown type of jsonb container.
Previous Message 德哥 2021-05-27 09:21:34 Re:Re: BUG #17036: generated column cann't modifyed auto when update