pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix some more cases of missed GENERATED-column updates.
5+ messages / 1 participants
[nested] [flat]

* pgsql: Fix some more cases of missed GENERATED-column updates.
@ 2023-03-06 23:31 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2023-03-06 23:31 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix some more cases of missed GENERATED-column updates.

If UPDATE is forced to retry after an EvalPlanQual check, it neglected
to repeat GENERATED-column computations, even though those might well
have changed since we're dealing with a different tuple than before.
Fixing this is mostly a matter of looping back a bit further when
we retry.  In v15 and HEAD that's most easily done by altering the API
of ExecUpdateAct so that it includes computing GENERATED expressions.

Also, if an UPDATE in a partitioned table turns into a cross-partition
INSERT operation, we failed to recompute GENERATED columns.  That's a
bug since 8bf6ec3ba allowed partitions to have different generation
expressions; although it seems to have no ill effects before that.
Fixing this is messier because we can now have situations where the same
query needs both the UPDATE-aligned set of GENERATED columns and the
INSERT-aligned set, and it's unclear which set will be generated first
(else we could hack things by forcing the INSERT-aligned set to be
generated, which is indeed how fe9e658f4 made it work for MERGE).
The best fix seems to be to build and store separate sets of expressions
for the INSERT and UPDATE cases.  That would create ABI issues in the
back branches, but so far it seems we can leave this alone in the back
branches.

Per bug #17823 from Hisahiro Kauchi.  The first part of this affects all
branches back to v12 where GENERATED columns were added.

Discussion: https://postgr.es/m/17823-b64909cf7d63de84@postgresql.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7fee7871b4302e916577df130344060d0f9b8004

Modified Files
--------------
src/backend/executor/execMain.c                |   3 +-
src/backend/executor/execUtils.c               |   4 +-
src/backend/executor/nodeModifyTable.c         | 125 ++++++----
src/include/nodes/execnodes.h                  |  10 +-
src/test/isolation/expected/eval-plan-qual.out | 304 +++++++++++++------------
src/test/isolation/specs/eval-plan-qual.spec   |  25 +-
src/test/regress/expected/generated.out        |  13 ++
src/test/regress/sql/generated.sql             |   3 +
8 files changed, 280 insertions(+), 207 deletions(-)



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* pgsql: Fix some more cases of missed GENERATED-column updates.
@ 2023-03-06 23:31 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2023-03-06 23:31 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix some more cases of missed GENERATED-column updates.

If UPDATE is forced to retry after an EvalPlanQual check, it neglected
to repeat GENERATED-column computations, even though those might well
have changed since we're dealing with a different tuple than before.
Fixing this is mostly a matter of looping back a bit further when
we retry.  In v15 and HEAD that's most easily done by altering the API
of ExecUpdateAct so that it includes computing GENERATED expressions.

Also, if an UPDATE in a partitioned table turns into a cross-partition
INSERT operation, we failed to recompute GENERATED columns.  That's a
bug since 8bf6ec3ba allowed partitions to have different generation
expressions; although it seems to have no ill effects before that.
Fixing this is messier because we can now have situations where the same
query needs both the UPDATE-aligned set of GENERATED columns and the
INSERT-aligned set, and it's unclear which set will be generated first
(else we could hack things by forcing the INSERT-aligned set to be
generated, which is indeed how fe9e658f4 made it work for MERGE).
The best fix seems to be to build and store separate sets of expressions
for the INSERT and UPDATE cases.  That would create ABI issues in the
back branches, but so far it seems we can leave this alone in the back
branches.

Per bug #17823 from Hisahiro Kauchi.  The first part of this affects all
branches back to v12 where GENERATED columns were added.

Discussion: https://postgr.es/m/17823-b64909cf7d63de84@postgresql.org

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/70ef509543fab4c35f79e73dd2b309cc75ceed51

Modified Files
--------------
src/backend/executor/execUtils.c               |   2 +-
src/backend/executor/nodeModifyTable.c         |  42 ++--
src/test/isolation/expected/eval-plan-qual.out | 304 +++++++++++++------------
src/test/isolation/specs/eval-plan-qual.spec   |  21 +-
src/test/regress/expected/generated.out        |  14 ++
src/test/regress/sql/generated.sql             |   4 +
6 files changed, 221 insertions(+), 166 deletions(-)



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* pgsql: Fix some more cases of missed GENERATED-column updates.
@ 2023-03-06 23:31 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2023-03-06 23:31 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix some more cases of missed GENERATED-column updates.

If UPDATE is forced to retry after an EvalPlanQual check, it neglected
to repeat GENERATED-column computations, even though those might well
have changed since we're dealing with a different tuple than before.
Fixing this is mostly a matter of looping back a bit further when
we retry.  In v15 and HEAD that's most easily done by altering the API
of ExecUpdateAct so that it includes computing GENERATED expressions.

Also, if an UPDATE in a partitioned table turns into a cross-partition
INSERT operation, we failed to recompute GENERATED columns.  That's a
bug since 8bf6ec3ba allowed partitions to have different generation
expressions; although it seems to have no ill effects before that.
Fixing this is messier because we can now have situations where the same
query needs both the UPDATE-aligned set of GENERATED columns and the
INSERT-aligned set, and it's unclear which set will be generated first
(else we could hack things by forcing the INSERT-aligned set to be
generated, which is indeed how fe9e658f4 made it work for MERGE).
The best fix seems to be to build and store separate sets of expressions
for the INSERT and UPDATE cases.  That would create ABI issues in the
back branches, but so far it seems we can leave this alone in the back
branches.

Per bug #17823 from Hisahiro Kauchi.  The first part of this affects all
branches back to v12 where GENERATED columns were added.

Discussion: https://postgr.es/m/17823-b64909cf7d63de84@postgresql.org

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/1e05ea51d327635ce56caab56cc47e70716e081f

Modified Files
--------------
src/backend/executor/execUtils.c               |   2 +-
src/backend/executor/nodeModifyTable.c         |  26 +--
src/test/isolation/expected/eval-plan-qual.out | 304 +++++++++++++------------
src/test/isolation/specs/eval-plan-qual.spec   |  21 +-
src/test/regress/expected/generated.out        |  14 ++
src/test/regress/sql/generated.sql             |   4 +
6 files changed, 207 insertions(+), 164 deletions(-)



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* pgsql: Fix some more cases of missed GENERATED-column updates.
@ 2023-03-06 23:31 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2023-03-06 23:31 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix some more cases of missed GENERATED-column updates.

If UPDATE is forced to retry after an EvalPlanQual check, it neglected
to repeat GENERATED-column computations, even though those might well
have changed since we're dealing with a different tuple than before.
Fixing this is mostly a matter of looping back a bit further when
we retry.  In v15 and HEAD that's most easily done by altering the API
of ExecUpdateAct so that it includes computing GENERATED expressions.

Also, if an UPDATE in a partitioned table turns into a cross-partition
INSERT operation, we failed to recompute GENERATED columns.  That's a
bug since 8bf6ec3ba allowed partitions to have different generation
expressions; although it seems to have no ill effects before that.
Fixing this is messier because we can now have situations where the same
query needs both the UPDATE-aligned set of GENERATED columns and the
INSERT-aligned set, and it's unclear which set will be generated first
(else we could hack things by forcing the INSERT-aligned set to be
generated, which is indeed how fe9e658f4 made it work for MERGE).
The best fix seems to be to build and store separate sets of expressions
for the INSERT and UPDATE cases.  That would create ABI issues in the
back branches, but so far it seems we can leave this alone in the back
branches.

Per bug #17823 from Hisahiro Kauchi.  The first part of this affects all
branches back to v12 where GENERATED columns were added.

Discussion: https://postgr.es/m/17823-b64909cf7d63de84@postgresql.org

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/4a94cbd02b2cc637c4a7636a1e7fefee43bff8f6

Modified Files
--------------
src/backend/executor/execUtils.c               |   2 +-
src/backend/executor/nodeModifyTable.c         |  30 +--
src/test/isolation/expected/eval-plan-qual.out | 304 +++++++++++++------------
src/test/isolation/specs/eval-plan-qual.spec   |  21 +-
src/test/regress/expected/generated.out        |  14 ++
src/test/regress/sql/generated.sql             |   4 +
6 files changed, 210 insertions(+), 165 deletions(-)



^ permalink  raw  reply  [nested|flat] 5+ messages in thread

* pgsql: Fix some more cases of missed GENERATED-column updates.
@ 2023-03-06 23:31 Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2023-03-06 23:31 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix some more cases of missed GENERATED-column updates.

If UPDATE is forced to retry after an EvalPlanQual check, it neglected
to repeat GENERATED-column computations, even though those might well
have changed since we're dealing with a different tuple than before.
Fixing this is mostly a matter of looping back a bit further when
we retry.  In v15 and HEAD that's most easily done by altering the API
of ExecUpdateAct so that it includes computing GENERATED expressions.

Also, if an UPDATE in a partitioned table turns into a cross-partition
INSERT operation, we failed to recompute GENERATED columns.  That's a
bug since 8bf6ec3ba allowed partitions to have different generation
expressions; although it seems to have no ill effects before that.
Fixing this is messier because we can now have situations where the same
query needs both the UPDATE-aligned set of GENERATED columns and the
INSERT-aligned set, and it's unclear which set will be generated first
(else we could hack things by forcing the INSERT-aligned set to be
generated, which is indeed how fe9e658f4 made it work for MERGE).
The best fix seems to be to build and store separate sets of expressions
for the INSERT and UPDATE cases.  That would create ABI issues in the
back branches, but so far it seems we can leave this alone in the back
branches.

Per bug #17823 from Hisahiro Kauchi.  The first part of this affects all
branches back to v12 where GENERATED columns were added.

Discussion: https://postgr.es/m/17823-b64909cf7d63de84@postgresql.org

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/23b75dd03da1a4a6db080b27bb3c8efcf7dbc9ae

Modified Files
--------------
src/backend/executor/nodeModifyTable.c         |  21 +-
src/test/isolation/expected/eval-plan-qual.out | 304 +++++++++++++------------
src/test/isolation/specs/eval-plan-qual.spec   |  21 +-
src/test/regress/expected/generated.out        |  14 ++
src/test/regress/sql/generated.sql             |   4 +
5 files changed, 204 insertions(+), 160 deletions(-)



^ permalink  raw  reply  [nested|flat] 5+ messages in thread


end of thread, other threads:[~2023-03-06 23:31 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-03-06 23:31 pgsql: Fix some more cases of missed GENERATED-column updates. Tom Lane <tgl@sss.pgh.pa.us>
2023-03-06 23:31 pgsql: Fix some more cases of missed GENERATED-column updates. Tom Lane <tgl@sss.pgh.pa.us>
2023-03-06 23:31 pgsql: Fix some more cases of missed GENERATED-column updates. Tom Lane <tgl@sss.pgh.pa.us>
2023-03-06 23:31 pgsql: Fix some more cases of missed GENERATED-column updates. Tom Lane <tgl@sss.pgh.pa.us>
2023-03-06 23:31 pgsql: Fix some more cases of missed GENERATED-column updates. Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox