Re: Generated column is not updated (Postgres 13)

From: Vitaly Ustinov <vitaly(at)ustinov(dot)ca>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, pgsql-bugs(at)lists(dot)postgresql(dot)org, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Subject: Re: Generated column is not updated (Postgres 13)
Date: 2021-05-20 19:07:34
Message-ID: CAM_DEiX+P9YvpeYu_Dc6WoW=d2kcLAC2O=pT_Y+e_eYhBTSLPg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

In a BEFORE trigger (PL/pgSQL) I can access not yet computed generated
columns via the "NEW" whole-row var. I can read from it (NULL), and I
can write to it, but the assigned value will be ignored.

This behavior seems obvious and well thought through to me. It's not
something app developers should do, because it wouldn't make sense,
but at least it's not forbidden and the server process does not crash
with a seg fault.

Is it okay with you that the patch 0002 introduces some inconsistency with that?

Regards,
Vitaly

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2021-05-20 21:09:08 Re: Generated column is not updated (Postgres 13)
Previous Message 'Bruce Momjian' 2021-05-20 18:29:50 Re: BUG #17020: meta command psql \reset does not clear the query buffer