pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Don't choose an invalid index for REPLICA IDENTITY FULL lookups.
5+ messages / 1 participants
[nested] [flat]

* pgsql: Don't choose an invalid index for REPLICA IDENTITY FULL lookups.
@ 2026-08-27 04:50 Amit Kapila <akapila@postgresql.org>
  0 siblings, 0 replies; 5+ messages in thread

From: Amit Kapila @ 2026-08-27 04:50 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Don't choose an invalid index for REPLICA IDENTITY FULL lookups.

For a REPLICA IDENTITY FULL remote relation whose local counterpart has
no primary key or replica identity, FindUsableIndexForReplicaIdentityFull()
chooses the first index of a suitable shape from RelationGetIndexList().
That list excludes only indexes that are not indislive, so an invalid
index left behind by a failed CREATE INDEX CONCURRENTLY can be selected.

Such an index need not contain every row. Consequently, changes for rows
that it fails to find can be silently dropped as missing-tuple conflicts.
If the index contains no rows at all, the scan can instead error out and
cause the apply worker to exit.

Skip invalid indexes, as the planner does.

Author: Mikhail Nikalayeu <mihailnikalayeu@gmail.com>
Reviewed-by: Miłosz Bieniek <bieniek.milosz@proton.me>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Shlok Kyal <shlok.kyal.oss@gmail.com>
Reviewed-by: Vignesh C <vignesh21@gmail.com>
Reviewed-by: Ajin Cherian <itsajin@gmail.com>
Discussion: https://postgr.es/m/CADzfLwWuubcbJBDRZ_J1SSqHDNjNmUYSAgf5y=17LxmP401xbw@mail.gmail.com
Backpatch-through: 16, where it was introduced

Branch
------
master

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

Modified Files
--------------
src/backend/replication/logical/relation.c         | 16 +++++-
src/test/subscription/t/032_subscribe_use_index.pl | 59 ++++++++++++++++++++++
2 files changed, 74 insertions(+), 1 deletion(-)



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

* pgsql: Don't choose an invalid index for REPLICA IDENTITY FULL lookups.
@ 2026-08-27 04:50 Amit Kapila <akapila@postgresql.org>
  0 siblings, 0 replies; 5+ messages in thread

From: Amit Kapila @ 2026-08-27 04:50 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Don't choose an invalid index for REPLICA IDENTITY FULL lookups.

For a REPLICA IDENTITY FULL remote relation whose local counterpart has
no primary key or replica identity, FindUsableIndexForReplicaIdentityFull()
chooses the first index of a suitable shape from RelationGetIndexList().
That list excludes only indexes that are not indislive, so an invalid
index left behind by a failed CREATE INDEX CONCURRENTLY can be selected.

Such an index need not contain every row. Consequently, changes for rows
that it fails to find can be silently dropped as missing-tuple conflicts.
If the index contains no rows at all, the scan can instead error out and
cause the apply worker to exit.

Skip invalid indexes, as the planner does.

Author: Mikhail Nikalayeu <mihailnikalayeu@gmail.com>
Reviewed-by: Miłosz Bieniek <bieniek.milosz@proton.me>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Shlok Kyal <shlok.kyal.oss@gmail.com>
Reviewed-by: Vignesh C <vignesh21@gmail.com>
Reviewed-by: Ajin Cherian <itsajin@gmail.com>
Discussion: https://postgr.es/m/CADzfLwWuubcbJBDRZ_J1SSqHDNjNmUYSAgf5y=17LxmP401xbw@mail.gmail.com
Backpatch-through: 16, where it was introduced

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/3c73b272b42ecad68ad5c970bfd62d714ae03828

Modified Files
--------------
src/backend/replication/logical/relation.c         | 16 +++++-
src/test/subscription/t/032_subscribe_use_index.pl | 59 ++++++++++++++++++++++
2 files changed, 74 insertions(+), 1 deletion(-)



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

* pgsql: Don't choose an invalid index for REPLICA IDENTITY FULL lookups.
@ 2026-08-27 04:50 Amit Kapila <akapila@postgresql.org>
  0 siblings, 0 replies; 5+ messages in thread

From: Amit Kapila @ 2026-08-27 04:50 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Don't choose an invalid index for REPLICA IDENTITY FULL lookups.

For a REPLICA IDENTITY FULL remote relation whose local counterpart has
no primary key or replica identity, FindUsableIndexForReplicaIdentityFull()
chooses the first index of a suitable shape from RelationGetIndexList().
That list excludes only indexes that are not indislive, so an invalid
index left behind by a failed CREATE INDEX CONCURRENTLY can be selected.

Such an index need not contain every row. Consequently, changes for rows
that it fails to find can be silently dropped as missing-tuple conflicts.
If the index contains no rows at all, the scan can instead error out and
cause the apply worker to exit.

Skip invalid indexes, as the planner does.

Author: Mikhail Nikalayeu <mihailnikalayeu@gmail.com>
Reviewed-by: Miłosz Bieniek <bieniek.milosz@proton.me>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Shlok Kyal <shlok.kyal.oss@gmail.com>
Reviewed-by: Vignesh C <vignesh21@gmail.com>
Reviewed-by: Ajin Cherian <itsajin@gmail.com>
Discussion: https://postgr.es/m/CADzfLwWuubcbJBDRZ_J1SSqHDNjNmUYSAgf5y=17LxmP401xbw@mail.gmail.com
Backpatch-through: 16, where it was introduced

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/38eb0cfa3c988bcb8b388fde118c35cf37a3a9d9

Modified Files
--------------
src/backend/replication/logical/relation.c         | 16 +++++-
src/test/subscription/t/032_subscribe_use_index.pl | 59 ++++++++++++++++++++++
2 files changed, 74 insertions(+), 1 deletion(-)



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

* pgsql: Don't choose an invalid index for REPLICA IDENTITY FULL lookups.
@ 2026-08-27 04:50 Amit Kapila <akapila@postgresql.org>
  0 siblings, 0 replies; 5+ messages in thread

From: Amit Kapila @ 2026-08-27 04:50 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Don't choose an invalid index for REPLICA IDENTITY FULL lookups.

For a REPLICA IDENTITY FULL remote relation whose local counterpart has
no primary key or replica identity, FindUsableIndexForReplicaIdentityFull()
chooses the first index of a suitable shape from RelationGetIndexList().
That list excludes only indexes that are not indislive, so an invalid
index left behind by a failed CREATE INDEX CONCURRENTLY can be selected.

Such an index need not contain every row. Consequently, changes for rows
that it fails to find can be silently dropped as missing-tuple conflicts.
If the index contains no rows at all, the scan can instead error out and
cause the apply worker to exit.

Skip invalid indexes, as the planner does.

Author: Mikhail Nikalayeu <mihailnikalayeu@gmail.com>
Reviewed-by: Miłosz Bieniek <bieniek.milosz@proton.me>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Shlok Kyal <shlok.kyal.oss@gmail.com>
Reviewed-by: Vignesh C <vignesh21@gmail.com>
Reviewed-by: Ajin Cherian <itsajin@gmail.com>
Discussion: https://postgr.es/m/CADzfLwWuubcbJBDRZ_J1SSqHDNjNmUYSAgf5y=17LxmP401xbw@mail.gmail.com
Backpatch-through: 16, where it was introduced

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/92c0182141cf6355f5ca38b282531aca64068d4e

Modified Files
--------------
src/backend/replication/logical/relation.c         | 16 +++++-
src/test/subscription/t/032_subscribe_use_index.pl | 59 ++++++++++++++++++++++
2 files changed, 74 insertions(+), 1 deletion(-)



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

* pgsql: Don't choose an invalid index for REPLICA IDENTITY FULL lookups.
@ 2026-08-27 04:50 Amit Kapila <akapila@postgresql.org>
  0 siblings, 0 replies; 5+ messages in thread

From: Amit Kapila @ 2026-08-27 04:50 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Don't choose an invalid index for REPLICA IDENTITY FULL lookups.

For a REPLICA IDENTITY FULL remote relation whose local counterpart has
no primary key or replica identity, FindUsableIndexForReplicaIdentityFull()
chooses the first index of a suitable shape from RelationGetIndexList().
That list excludes only indexes that are not indislive, so an invalid
index left behind by a failed CREATE INDEX CONCURRENTLY can be selected.

Such an index need not contain every row. Consequently, changes for rows
that it fails to find can be silently dropped as missing-tuple conflicts.
If the index contains no rows at all, the scan can instead error out and
cause the apply worker to exit.

Skip invalid indexes, as the planner does.

Author: Mikhail Nikalayeu <mihailnikalayeu@gmail.com>
Reviewed-by: Miłosz Bieniek <bieniek.milosz@proton.me>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Shlok Kyal <shlok.kyal.oss@gmail.com>
Reviewed-by: Vignesh C <vignesh21@gmail.com>
Reviewed-by: Ajin Cherian <itsajin@gmail.com>
Discussion: https://postgr.es/m/CADzfLwWuubcbJBDRZ_J1SSqHDNjNmUYSAgf5y=17LxmP401xbw@mail.gmail.com
Backpatch-through: 16, where it was introduced

Branch
------
REL_16_STABLE

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

Modified Files
--------------
src/backend/replication/logical/relation.c         | 16 +++++-
src/test/subscription/t/032_subscribe_use_index.pl | 59 ++++++++++++++++++++++
2 files changed, 74 insertions(+), 1 deletion(-)



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


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

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-08-27 04:50 pgsql: Don't choose an invalid index for REPLICA IDENTITY FULL lookups. Amit Kapila <akapila@postgresql.org>
2026-08-27 04:50 pgsql: Don't choose an invalid index for REPLICA IDENTITY FULL lookups. Amit Kapila <akapila@postgresql.org>
2026-08-27 04:50 pgsql: Don't choose an invalid index for REPLICA IDENTITY FULL lookups. Amit Kapila <akapila@postgresql.org>
2026-08-27 04:50 pgsql: Don't choose an invalid index for REPLICA IDENTITY FULL lookups. Amit Kapila <akapila@postgresql.org>
2026-08-27 04:50 pgsql: Don't choose an invalid index for REPLICA IDENTITY FULL lookups. Amit Kapila <akapila@postgresql.org>

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