Preserve opclass parameters across REINDEX CONCURRENTLY
authorMichael Paquier <michael@paquier.xyz>
Mon, 1 Nov 2021 02:40:29 +0000 (11:40 +0900)
committerMichael Paquier <michael@paquier.xyz>
Mon, 1 Nov 2021 02:40:29 +0000 (11:40 +0900)
commit77f7909a409eac9ee9a5728a4f80741925580fb6
treeb72532b036af3a3b258b7809ad2d9930085468b4
parent3a5b313ce74864303a8a5d6556b49d642c422922
Preserve opclass parameters across REINDEX CONCURRENTLY

The opclass parameter Datums from the old index are fetched in the same
way as for predicates and expressions, by grabbing them directly from
the system catalogs.  They are then copied into the new IndexInfo that
will be used for the creation of the new copy.

This caused the new index to be rebuilt with default parameters rather
than the ones pre-defined by a user.  The only way to get back a new
index with correct opclass parameters would be to recreate a new index
from scratch.

The issue has been introduced by 911e702.

Author: Michael Paquier
Reviewed-by: Zhihong Yu
Discussion: https://postgr.es/m/YX0CG/QpLXcPr8HJ@paquier.xyz
Backpatch-through: 13
src/backend/catalog/index.c
src/test/regress/expected/create_index.out
src/test/regress/sql/create_index.sql