Re: BUG #17036: generated column cann't modifyed auto when update - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #17036: generated column cann't modifyed auto when update
Date
Msg-id 1684301.1622084940@sss.pgh.pa.us
Whole thread Raw
In response to Re:Re: BUG #17036: generated column cann't modifyed auto when update  (德哥 <digoal@126.com>)
Responses Re:Re: BUG #17036: generated column cann't modifyed auto when update  (德哥 <digoal@126.com>)
List pgsql-bugs
=?GBK?B?tcK45w==?= <digoal@126.com> writes:
> The generated column can be used to automatically generate the modified timestamp of a tuple, but PG 12 currently
supportsthis scenario. PG 13 has started to change its behavior, which makes our application need to be modified. This
isthe 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



pgsql-bugs by date:

Previous
From: RekGRpth
Date:
Subject: Re: BUG #17035: assert after commit
Next
From: "David G. Johnston"
Date:
Subject: Re: BUG #17036: generated column cann't modifyed auto when update