Re: generated columns bug, see inconsistent data

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
Cc: pgsql-bugs <pgsql-bugs(at)lists(dot)postgresql(dot)org>, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
Subject: Re: generated columns bug, see inconsistent data
Date: 2022-10-26 01:35:00
Message-ID: 144386.1666748100@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Jeff Janes <jeff(dot)janes(at)gmail(dot)com> writes:
> I can reproduce the issue in all recent versions (didn't check before 12),
> including 15.0 and 16dev. You can see rows in which the generated column
> has a value inconsistent with the columns it is generated from.

My first guess about this is that we're failing to recalculate generated
columns in the EPQ code path where an update is re-applied to a
just-modified row. Can you tell whether the inconsistencies are
associated with rows that get updated twice in quick succession (by
different sessions)? Does the problem go away under serializable mode?

> If I copy the core expression of the immutable function into the generated
> column expression, leaving the function just for the monitoring query, then
> I never see the inconsistency.

Maybe that changes the timing?

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message PG Bug reporting form 2022-10-26 08:59:52 BUG #17663: Connect to the database through jdbc, call the stored procedure containing the rollback statement,
Previous Message Jeff Janes 2022-10-26 00:58:50 generated columns bug, see inconsistent data