pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix ExecCheckIndexConstraints() crash when es_snapshot is invali
7+ messages / 1 participants
[nested] [flat]

* pgsql: Fix ExecCheckIndexConstraints() crash when es_snapshot is invali
@ 2026-11-04 19:50 Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 7+ messages in thread

From: Dean Rasheed @ 2026-11-04 19:50 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix ExecCheckIndexConstraints() crash when es_snapshot is invalid.

At transaction level SERIALIZABLE, commit fb60892f403 made
check_exclusion_or_unique_constraint() read the conflicting tuple
again using estate->es_snapshot when violationOK is true and
conflictTid is non-NULL, to ensure that INSERT ... ON CONFLICT takes
an SIREAD lock. This can only happen from ExecCheckIndexConstraints(),
but not all callers of ExecCheckIndexConstraints() initialize
estate->es_snapshot, and the re-fetch crashes if it's invalid.

In core Postgres, this only affects the logical replication apply
worker which, starting from v18, uses ExecCheckIndexConstraints() to
log conflicts while applying changes, without initializing es_snapshot
in the EState that it builds. However, there is also extension code
that does the same, so the problem affects all versions that
fb60892f403 was applied to.

Fix by skipping the re-fetch in check_exclusion_or_unique_constraint()
if the snapshot is invalid.

Reported-by: Zsolt Parragi <zsolt.parragi@percona.com>
Author: Zsolt Parragi <zsolt.parragi@percona.com>
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Discussion: https://postgr.es/m/CAN4CZFPz4ysPyo1ahD-5n0iyKxmuo2Wvn%3DPgEZTyW63_Tu7Eaw%40mail.gmail.com
Backpatch-through: 14

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/76e9e44b03a3028d3ef79bc334bc45722a96ce4e

Modified Files
--------------
src/backend/executor/execIndexing.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)



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

* pgsql: Fix ExecCheckIndexConstraints() crash when es_snapshot is invali
@ 2026-11-04 19:50 Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 7+ messages in thread

From: Dean Rasheed @ 2026-11-04 19:50 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix ExecCheckIndexConstraints() crash when es_snapshot is invalid.

At transaction level SERIALIZABLE, commit fb60892f403 made
check_exclusion_or_unique_constraint() read the conflicting tuple
again using estate->es_snapshot when violationOK is true and
conflictTid is non-NULL, to ensure that INSERT ... ON CONFLICT takes
an SIREAD lock. This can only happen from ExecCheckIndexConstraints(),
but not all callers of ExecCheckIndexConstraints() initialize
estate->es_snapshot, and the re-fetch crashes if it's invalid.

In core Postgres, this only affects the logical replication apply
worker which, starting from v18, uses ExecCheckIndexConstraints() to
log conflicts while applying changes, without initializing es_snapshot
in the EState that it builds. However, there is also extension code
that does the same, so the problem affects all versions that
fb60892f403 was applied to.

Fix by skipping the re-fetch in check_exclusion_or_unique_constraint()
if the snapshot is invalid.

Reported-by: Zsolt Parragi <zsolt.parragi@percona.com>
Author: Zsolt Parragi <zsolt.parragi@percona.com>
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Discussion: https://postgr.es/m/CAN4CZFPz4ysPyo1ahD-5n0iyKxmuo2Wvn%3DPgEZTyW63_Tu7Eaw%40mail.gmail.com
Backpatch-through: 14

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/2980e5e4d3f5c56b02f6a321e40d154e889b560c

Modified Files
--------------
src/backend/executor/execIndexing.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)



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

* pgsql: Fix ExecCheckIndexConstraints() crash when es_snapshot is invali
@ 2026-11-04 19:50 Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 7+ messages in thread

From: Dean Rasheed @ 2026-11-04 19:50 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix ExecCheckIndexConstraints() crash when es_snapshot is invalid.

At transaction level SERIALIZABLE, commit fb60892f403 made
check_exclusion_or_unique_constraint() read the conflicting tuple
again using estate->es_snapshot when violationOK is true and
conflictTid is non-NULL, to ensure that INSERT ... ON CONFLICT takes
an SIREAD lock. This can only happen from ExecCheckIndexConstraints(),
but not all callers of ExecCheckIndexConstraints() initialize
estate->es_snapshot, and the re-fetch crashes if it's invalid.

In core Postgres, this only affects the logical replication apply
worker which, starting from v18, uses ExecCheckIndexConstraints() to
log conflicts while applying changes, without initializing es_snapshot
in the EState that it builds. However, there is also extension code
that does the same, so the problem affects all versions that
fb60892f403 was applied to.

Fix by skipping the re-fetch in check_exclusion_or_unique_constraint()
if the snapshot is invalid.

Reported-by: Zsolt Parragi <zsolt.parragi@percona.com>
Author: Zsolt Parragi <zsolt.parragi@percona.com>
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Discussion: https://postgr.es/m/CAN4CZFPz4ysPyo1ahD-5n0iyKxmuo2Wvn%3DPgEZTyW63_Tu7Eaw%40mail.gmail.com
Backpatch-through: 14

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/558c00f9676e14ad8bad3d3db9c41cf443ba2854

Modified Files
--------------
src/backend/executor/execIndexing.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)



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

* pgsql: Fix ExecCheckIndexConstraints() crash when es_snapshot is invali
@ 2026-11-04 19:50 Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 7+ messages in thread

From: Dean Rasheed @ 2026-11-04 19:50 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix ExecCheckIndexConstraints() crash when es_snapshot is invalid.

At transaction level SERIALIZABLE, commit fb60892f403 made
check_exclusion_or_unique_constraint() read the conflicting tuple
again using estate->es_snapshot when violationOK is true and
conflictTid is non-NULL, to ensure that INSERT ... ON CONFLICT takes
an SIREAD lock. This can only happen from ExecCheckIndexConstraints(),
but not all callers of ExecCheckIndexConstraints() initialize
estate->es_snapshot, and the re-fetch crashes if it's invalid.

In core Postgres, this only affects the logical replication apply
worker which, starting from v18, uses ExecCheckIndexConstraints() to
log conflicts while applying changes, without initializing es_snapshot
in the EState that it builds. However, there is also extension code
that does the same, so the problem affects all versions that
fb60892f403 was applied to.

Fix by skipping the re-fetch in check_exclusion_or_unique_constraint()
if the snapshot is invalid.

Reported-by: Zsolt Parragi <zsolt.parragi@percona.com>
Author: Zsolt Parragi <zsolt.parragi@percona.com>
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Discussion: https://postgr.es/m/CAN4CZFPz4ysPyo1ahD-5n0iyKxmuo2Wvn%3DPgEZTyW63_Tu7Eaw%40mail.gmail.com
Backpatch-through: 14

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/0d83f9e0ee04aeb60b846e3c65437ace4ffd1d5c

Modified Files
--------------
src/backend/executor/execIndexing.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)



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

* pgsql: Fix ExecCheckIndexConstraints() crash when es_snapshot is invali
@ 2026-11-04 19:50 Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 7+ messages in thread

From: Dean Rasheed @ 2026-11-04 19:50 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix ExecCheckIndexConstraints() crash when es_snapshot is invalid.

At transaction level SERIALIZABLE, commit fb60892f403 made
check_exclusion_or_unique_constraint() read the conflicting tuple
again using estate->es_snapshot when violationOK is true and
conflictTid is non-NULL, to ensure that INSERT ... ON CONFLICT takes
an SIREAD lock. This can only happen from ExecCheckIndexConstraints(),
but not all callers of ExecCheckIndexConstraints() initialize
estate->es_snapshot, and the re-fetch crashes if it's invalid.

In core Postgres, this only affects the logical replication apply
worker which, starting from v18, uses ExecCheckIndexConstraints() to
log conflicts while applying changes, without initializing es_snapshot
in the EState that it builds. However, there is also extension code
that does the same, so the problem affects all versions that
fb60892f403 was applied to.

Fix by skipping the re-fetch in check_exclusion_or_unique_constraint()
if the snapshot is invalid.

Reported-by: Zsolt Parragi <zsolt.parragi@percona.com>
Author: Zsolt Parragi <zsolt.parragi@percona.com>
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Discussion: https://postgr.es/m/CAN4CZFPz4ysPyo1ahD-5n0iyKxmuo2Wvn%3DPgEZTyW63_Tu7Eaw%40mail.gmail.com
Backpatch-through: 14

Branch
------
REL_16_STABLE

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

Modified Files
--------------
src/backend/executor/execIndexing.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)



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

* pgsql: Fix ExecCheckIndexConstraints() crash when es_snapshot is invali
@ 2026-11-04 19:50 Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 7+ messages in thread

From: Dean Rasheed @ 2026-11-04 19:50 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix ExecCheckIndexConstraints() crash when es_snapshot is invalid.

At transaction level SERIALIZABLE, commit fb60892f403 made
check_exclusion_or_unique_constraint() read the conflicting tuple
again using estate->es_snapshot when violationOK is true and
conflictTid is non-NULL, to ensure that INSERT ... ON CONFLICT takes
an SIREAD lock. This can only happen from ExecCheckIndexConstraints(),
but not all callers of ExecCheckIndexConstraints() initialize
estate->es_snapshot, and the re-fetch crashes if it's invalid.

In core Postgres, this only affects the logical replication apply
worker which, starting from v18, uses ExecCheckIndexConstraints() to
log conflicts while applying changes, without initializing es_snapshot
in the EState that it builds. However, there is also extension code
that does the same, so the problem affects all versions that
fb60892f403 was applied to.

Fix by skipping the re-fetch in check_exclusion_or_unique_constraint()
if the snapshot is invalid.

Reported-by: Zsolt Parragi <zsolt.parragi@percona.com>
Author: Zsolt Parragi <zsolt.parragi@percona.com>
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Discussion: https://postgr.es/m/CAN4CZFPz4ysPyo1ahD-5n0iyKxmuo2Wvn%3DPgEZTyW63_Tu7Eaw%40mail.gmail.com
Backpatch-through: 14

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/2c48710934728bc65e418bcc9ebdc88f490416ff

Modified Files
--------------
src/backend/executor/execIndexing.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)



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

* pgsql: Fix ExecCheckIndexConstraints() crash when es_snapshot is invali
@ 2026-11-04 19:50 Dean Rasheed <dean.a.rasheed@gmail.com>
  0 siblings, 0 replies; 7+ messages in thread

From: Dean Rasheed @ 2026-11-04 19:50 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix ExecCheckIndexConstraints() crash when es_snapshot is invalid.

At transaction level SERIALIZABLE, commit fb60892f403 made
check_exclusion_or_unique_constraint() read the conflicting tuple
again using estate->es_snapshot when violationOK is true and
conflictTid is non-NULL, to ensure that INSERT ... ON CONFLICT takes
an SIREAD lock. This can only happen from ExecCheckIndexConstraints(),
but not all callers of ExecCheckIndexConstraints() initialize
estate->es_snapshot, and the re-fetch crashes if it's invalid.

In core Postgres, this only affects the logical replication apply
worker which, starting from v18, uses ExecCheckIndexConstraints() to
log conflicts while applying changes, without initializing es_snapshot
in the EState that it builds. However, there is also extension code
that does the same, so the problem affects all versions that
fb60892f403 was applied to.

Fix by skipping the re-fetch in check_exclusion_or_unique_constraint()
if the snapshot is invalid.

Reported-by: Zsolt Parragi <zsolt.parragi@percona.com>
Author: Zsolt Parragi <zsolt.parragi@percona.com>
Reviewed-by: Andrey Borodin <x4mmm@yandex-team.ru>
Discussion: https://postgr.es/m/CAN4CZFPz4ysPyo1ahD-5n0iyKxmuo2Wvn%3DPgEZTyW63_Tu7Eaw%40mail.gmail.com
Backpatch-through: 14

Branch
------
REL_14_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/83efe9602ecdad32ffe766ba0deab02b5fb0da93

Modified Files
--------------
src/backend/executor/execIndexing.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)



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


end of thread, other threads:[~2026-11-04 19:50 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-11-04 19:50 pgsql: Fix ExecCheckIndexConstraints() crash when es_snapshot is invali Dean Rasheed <dean.a.rasheed@gmail.com>
2026-11-04 19:50 pgsql: Fix ExecCheckIndexConstraints() crash when es_snapshot is invali Dean Rasheed <dean.a.rasheed@gmail.com>
2026-11-04 19:50 pgsql: Fix ExecCheckIndexConstraints() crash when es_snapshot is invali Dean Rasheed <dean.a.rasheed@gmail.com>
2026-11-04 19:50 pgsql: Fix ExecCheckIndexConstraints() crash when es_snapshot is invali Dean Rasheed <dean.a.rasheed@gmail.com>
2026-11-04 19:50 pgsql: Fix ExecCheckIndexConstraints() crash when es_snapshot is invali Dean Rasheed <dean.a.rasheed@gmail.com>
2026-11-04 19:50 pgsql: Fix ExecCheckIndexConstraints() crash when es_snapshot is invali Dean Rasheed <dean.a.rasheed@gmail.com>
2026-11-04 19:50 pgsql: Fix ExecCheckIndexConstraints() crash when es_snapshot is invali Dean Rasheed <dean.a.rasheed@gmail.com>

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