From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | 德哥 <digoal(at)126(dot)com> |
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: BUG #17036: generated column cann't modifyed auto when update |
Date: | 2021-05-27 03:09:00 |
Message-ID: | 1684301.1622084940@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
=?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
From | Date | Subject | |
---|---|---|---|
Next Message | David G. Johnston | 2021-05-27 03:16:10 | Re: BUG #17036: generated column cann't modifyed auto when update |
Previous Message | RekGRpth | 2021-05-27 03:00:59 | Re: BUG #17035: assert after commit |