pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix MakeTransitionCaptureState() to return a consistent result
6+ messages / 1 participants
[nested] [flat]

* pgsql: Fix MakeTransitionCaptureState() to return a consistent result
@ 2025-02-13 07:31  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2025-02-13 07:31 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix MakeTransitionCaptureState() to return a consistent result

When an UPDATE trigger referencing a new table and a DELETE trigger
referencing an old table are both present, MakeTransitionCaptureState()
returns an inconsistent result for UPDATE commands in its set of flags
and tuplestores holding the TransitionCaptureState for transition
tables.

As proved by the test added here, this issue causes a crash in v14 and
earlier versions (down to 11, actually, older versions do not support
triggers on partitioned tables) during cross-partition updates on a
partitioned table.  v15 and newer versions are safe thanks to
7103ebb7aae8.

This commit fixes the function so that it returns a consistent state
by using portions of the changes made in commit 7103ebb7aae8 for v13 and
v14.  v15 and newer versions are slightly tweaked to match with the
older versions, mainly for consistency across branches.

Author: Kyotaro Horiguchi
Discussion: https://postgr.es/m/20250207.150238.968446820828052276.horikyota.ntt@gmail.com
Backpatch-through: 13

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/8e58f8024d0a70b3605da664cf35debf88b84e33

Modified Files
--------------
src/backend/commands/trigger.c         | 36 ++++++++++++++-----------
src/test/regress/expected/triggers.out | 49 ++++++++++++++++++++++++++++++++++
src/test/regress/sql/triggers.sql      | 46 +++++++++++++++++++++++++++++++
3 files changed, 115 insertions(+), 16 deletions(-)



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

* pgsql: Fix MakeTransitionCaptureState() to return a consistent result
@ 2025-02-13 07:31  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2025-02-13 07:31 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix MakeTransitionCaptureState() to return a consistent result

When an UPDATE trigger referencing a new table and a DELETE trigger
referencing an old table are both present, MakeTransitionCaptureState()
returns an inconsistent result for UPDATE commands in its set of flags
and tuplestores holding the TransitionCaptureState for transition
tables.

As proved by the test added here, this issue causes a crash in v14 and
earlier versions (down to 11, actually, older versions do not support
triggers on partitioned tables) during cross-partition updates on a
partitioned table.  v15 and newer versions are safe thanks to
7103ebb7aae8.

This commit fixes the function so that it returns a consistent state
by using portions of the changes made in commit 7103ebb7aae8 for v13 and
v14.  v15 and newer versions are slightly tweaked to match with the
older versions, mainly for consistency across branches.

Author: Kyotaro Horiguchi
Discussion: https://postgr.es/m/20250207.150238.968446820828052276.horikyota.ntt@gmail.com
Backpatch-through: 13

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/a37c83d1e465399fb1398507b6634f4dce76964c

Modified Files
--------------
src/backend/commands/trigger.c         |  8 +++---
src/test/regress/expected/triggers.out | 49 ++++++++++++++++++++++++++++++++++
src/test/regress/sql/triggers.sql      | 46 +++++++++++++++++++++++++++++++
3 files changed, 99 insertions(+), 4 deletions(-)



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

* pgsql: Fix MakeTransitionCaptureState() to return a consistent result
@ 2025-02-13 07:31  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2025-02-13 07:31 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix MakeTransitionCaptureState() to return a consistent result

When an UPDATE trigger referencing a new table and a DELETE trigger
referencing an old table are both present, MakeTransitionCaptureState()
returns an inconsistent result for UPDATE commands in its set of flags
and tuplestores holding the TransitionCaptureState for transition
tables.

As proved by the test added here, this issue causes a crash in v14 and
earlier versions (down to 11, actually, older versions do not support
triggers on partitioned tables) during cross-partition updates on a
partitioned table.  v15 and newer versions are safe thanks to
7103ebb7aae8.

This commit fixes the function so that it returns a consistent state
by using portions of the changes made in commit 7103ebb7aae8 for v13 and
v14.  v15 and newer versions are slightly tweaked to match with the
older versions, mainly for consistency across branches.

Author: Kyotaro Horiguchi
Discussion: https://postgr.es/m/20250207.150238.968446820828052276.horikyota.ntt@gmail.com
Backpatch-through: 13

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/773c51dd39ada5f107a3656377a9611ff89132f1

Modified Files
--------------
src/backend/commands/trigger.c         |  8 +++---
src/test/regress/expected/triggers.out | 49 ++++++++++++++++++++++++++++++++++
src/test/regress/sql/triggers.sql      | 46 +++++++++++++++++++++++++++++++
3 files changed, 99 insertions(+), 4 deletions(-)



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

* pgsql: Fix MakeTransitionCaptureState() to return a consistent result
@ 2025-02-13 07:31  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2025-02-13 07:31 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix MakeTransitionCaptureState() to return a consistent result

When an UPDATE trigger referencing a new table and a DELETE trigger
referencing an old table are both present, MakeTransitionCaptureState()
returns an inconsistent result for UPDATE commands in its set of flags
and tuplestores holding the TransitionCaptureState for transition
tables.

As proved by the test added here, this issue causes a crash in v14 and
earlier versions (down to 11, actually, older versions do not support
triggers on partitioned tables) during cross-partition updates on a
partitioned table.  v15 and newer versions are safe thanks to
7103ebb7aae8.

This commit fixes the function so that it returns a consistent state
by using portions of the changes made in commit 7103ebb7aae8 for v13 and
v14.  v15 and newer versions are slightly tweaked to match with the
older versions, mainly for consistency across branches.

Author: Kyotaro Horiguchi
Discussion: https://postgr.es/m/20250207.150238.968446820828052276.horikyota.ntt@gmail.com
Backpatch-through: 13

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/5209058240f37cf794ccbe832f3de6c6e649a17d

Modified Files
--------------
src/backend/commands/trigger.c         | 36 ++++++++++++++-----------
src/test/regress/expected/triggers.out | 49 ++++++++++++++++++++++++++++++++++
src/test/regress/sql/triggers.sql      | 46 +++++++++++++++++++++++++++++++
3 files changed, 115 insertions(+), 16 deletions(-)



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

* pgsql: Fix MakeTransitionCaptureState() to return a consistent result
@ 2025-02-13 07:31  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2025-02-13 07:31 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix MakeTransitionCaptureState() to return a consistent result

When an UPDATE trigger referencing a new table and a DELETE trigger
referencing an old table are both present, MakeTransitionCaptureState()
returns an inconsistent result for UPDATE commands in its set of flags
and tuplestores holding the TransitionCaptureState for transition
tables.

As proved by the test added here, this issue causes a crash in v14 and
earlier versions (down to 11, actually, older versions do not support
triggers on partitioned tables) during cross-partition updates on a
partitioned table.  v15 and newer versions are safe thanks to
7103ebb7aae8.

This commit fixes the function so that it returns a consistent state
by using portions of the changes made in commit 7103ebb7aae8 for v13 and
v14.  v15 and newer versions are slightly tweaked to match with the
older versions, mainly for consistency across branches.

Author: Kyotaro Horiguchi
Discussion: https://postgr.es/m/20250207.150238.968446820828052276.horikyota.ntt@gmail.com
Backpatch-through: 13

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/6342d49d89b95503444bb4fba01b85e1b24e8880

Modified Files
--------------
src/backend/commands/trigger.c         |  8 +++---
src/test/regress/expected/triggers.out | 49 ++++++++++++++++++++++++++++++++++
src/test/regress/sql/triggers.sql      | 46 +++++++++++++++++++++++++++++++
3 files changed, 99 insertions(+), 4 deletions(-)



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

* pgsql: Fix MakeTransitionCaptureState() to return a consistent result
@ 2025-02-13 07:31  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 6+ messages in thread

From: Michael Paquier @ 2025-02-13 07:31 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix MakeTransitionCaptureState() to return a consistent result

When an UPDATE trigger referencing a new table and a DELETE trigger
referencing an old table are both present, MakeTransitionCaptureState()
returns an inconsistent result for UPDATE commands in its set of flags
and tuplestores holding the TransitionCaptureState for transition
tables.

As proved by the test added here, this issue causes a crash in v14 and
earlier versions (down to 11, actually, older versions do not support
triggers on partitioned tables) during cross-partition updates on a
partitioned table.  v15 and newer versions are safe thanks to
7103ebb7aae8.

This commit fixes the function so that it returns a consistent state
by using portions of the changes made in commit 7103ebb7aae8 for v13 and
v14.  v15 and newer versions are slightly tweaked to match with the
older versions, mainly for consistency across branches.

Author: Kyotaro Horiguchi
Discussion: https://postgr.es/m/20250207.150238.968446820828052276.horikyota.ntt@gmail.com
Backpatch-through: 13

Branch
------
REL_16_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/139beb0355c2a3c96df8c629a424eb38cba238b5

Modified Files
--------------
src/backend/commands/trigger.c         |  8 +++---
src/test/regress/expected/triggers.out | 49 ++++++++++++++++++++++++++++++++++
src/test/regress/sql/triggers.sql      | 46 +++++++++++++++++++++++++++++++
3 files changed, 99 insertions(+), 4 deletions(-)



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


end of thread, other threads:[~2025-02-13 07:31 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-02-13 07:31 pgsql: Fix MakeTransitionCaptureState() to return a consistent result Michael Paquier <michael@paquier.xyz>
2025-02-13 07:31 pgsql: Fix MakeTransitionCaptureState() to return a consistent result Michael Paquier <michael@paquier.xyz>
2025-02-13 07:31 pgsql: Fix MakeTransitionCaptureState() to return a consistent result Michael Paquier <michael@paquier.xyz>
2025-02-13 07:31 pgsql: Fix MakeTransitionCaptureState() to return a consistent result Michael Paquier <michael@paquier.xyz>
2025-02-13 07:31 pgsql: Fix MakeTransitionCaptureState() to return a consistent result Michael Paquier <michael@paquier.xyz>
2025-02-13 07:31 pgsql: Fix MakeTransitionCaptureState() to return a consistent result Michael Paquier <michael@paquier.xyz>

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