pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix dependency handling at swap phase of REINDEX CONCURRENTLY
2+ messages / 1 participants
[nested] [flat]

* pgsql: Fix dependency handling at swap phase of REINDEX CONCURRENTLY
@ 2019-10-28 03:13  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Paquier @ 2019-10-28 03:13 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix dependency handling at swap phase of REINDEX CONCURRENTLY

When swapping the dependencies of the old and new indexes, the code has
been correctly switching all links in pg_depend from the old to the new
index for both referencing and referenced entries.  However it forgot
the fact that the new index may itself have existing entries in
pg_depend, like references to the parent table attributes.  This
resulted in duplicated entries in pg_depend after running REINDEX
CONCURRENTLY.

Fix this problem by removing any existing entries in pg_depend on the
new index before switching the dependencies of the old index to the new
one.  More regression tests are added to check the consistency of
entries in pg_depend for indexes, including partition indexes.

Author: Michael Paquier
Discussion: https://postgr.es/m/20191025064318.GF8671@paquier.xyz
Backpatch-through: 12

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/68ac9cf2499236996f3d4bf31f7f16d5bd3c77af

Modified Files
--------------
src/backend/catalog/index.c                |   6 +-
src/test/regress/expected/create_index.out | 126 +++++++++++++++++++++++++++++
src/test/regress/sql/create_index.sql      |  54 +++++++++++++
3 files changed, 185 insertions(+), 1 deletion(-)



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

* pgsql: Fix dependency handling at swap phase of REINDEX CONCURRENTLY
@ 2019-10-28 03:13  Michael Paquier <michael@paquier.xyz>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Paquier @ 2019-10-28 03:13 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix dependency handling at swap phase of REINDEX CONCURRENTLY

When swapping the dependencies of the old and new indexes, the code has
been correctly switching all links in pg_depend from the old to the new
index for both referencing and referenced entries.  However it forgot
the fact that the new index may itself have existing entries in
pg_depend, like references to the parent table attributes.  This
resulted in duplicated entries in pg_depend after running REINDEX
CONCURRENTLY.

Fix this problem by removing any existing entries in pg_depend for the
new index before switching the dependencies of the old index to the new
one.  More regression tests are added to check the consistency of
entries in pg_depend for indexes, including partitions.

Author: Michael Paquier
Discussion: https://postgr.es/m/20191025064318.GF8671@paquier.xyz
Backpatch-through: 12

Branch
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/5e5f32284d691d0be71d6859c1de9b0367b26584

Modified Files
--------------
src/backend/catalog/index.c                |   6 +-
src/test/regress/expected/create_index.out | 126 +++++++++++++++++++++++++++++
src/test/regress/sql/create_index.sql      |  54 +++++++++++++
3 files changed, 185 insertions(+), 1 deletion(-)



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


end of thread, other threads:[~2019-10-28 03:13 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-10-28 03:13 pgsql: Fix dependency handling at swap phase of REINDEX CONCURRENTLY Michael Paquier <michael@paquier.xyz>
2019-10-28 03:13 pgsql: Fix dependency handling at swap phase of REINDEX CONCURRENTLY 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