When the index cannot be used to find a recently deleted row, RelationFindDeletedTupleInfoSeq() scans the table. It looked up the relation's replica identity or primary key again to determine which columns to compare, which could differ from the index selected when the relation was opened. A concurrent DROP INDEX CONCURRENTLY could remove the replica identity in between, so the search compared the whole row and reported the conflict as update_deleted instead of update_missing. Use the index recorded in the relation map instead. The relation map already records the replica identity index, or the primary key if there is no replica identity. It also avoids using a deferrable primary key, which cannot serve as a replica identity; using its columns could incorrectly report a deleted row with different values as update_deleted instead of update_missing. Author: Hayato Kuroda <kuroda.hayato@fujitsu.com> Author: Nisha Moond <nisha.moond412@gmail.com> Reviewed-by: Vignesh C <vignesh21@gmail.com> Reviewed-by: Zhijie Hou <houzhijie22@gmail.com> Reviewed-by: Amit Kapila <amit.kapila16@gmail.com> Discussion: https://postgr.es/m/CABdArM5ydwdRrpaZyK1q2p3-vY_+pnBtTmkvg_pcM=gHwmH7Kg@mail.gmail.com Discussion: https://postgr.es/m/OS7PR01MB1831779ED93F5470CA1D57605F58C2@OS7PR01MB18317.jpnprd01.prod.outlook.com Backpatch-through: 19
PostgreSQL Database Management System
This directory contains the source code distribution of the PostgreSQL database management system.
PostgreSQL is an advanced object-relational database management system that supports an extended subset of the SQL standard, including transactions, foreign keys, subqueries, triggers, user-defined types and functions. This distribution also contains C language bindings.
Copyright and license information can be found in the file COPYRIGHT.
General documentation about this version of PostgreSQL can be found at https://www.postgresql.org/docs/devel/. In particular, information about building PostgreSQL from the source code can be found at https://www.postgresql.org/docs/devel/installation.html.
The latest version of this software, and related software, may be obtained at https://www.postgresql.org/download/. For more information look at our web site located at https://www.postgresql.org/.