pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix handling of expressions and predicates in REINDEX CONCURRENT 2+ messages / 1 participants [nested] [flat]
* pgsql: Fix handling of expressions and predicates in REINDEX CONCURRENT @ 2019-07-29 01:08 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 2+ messages in thread From: Michael Paquier @ 2019-07-29 01:08 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix handling of expressions and predicates in REINDEX CONCURRENTLY When copying the definition of an index rebuilt concurrently for the new entry, the index information was taken directly from the old index using the relation cache. In this case, predicates and expressions have some post-processing to prepare things for the planner, which loses some information including the collations added in any of them. This inconsistency can cause issues when attempting for example a table rewrite, and makes the new indexes rebuilt concurrently inconsistent with the old entries. In order to fix the problem, fetch expressions and predicates directly from the catalog of the old entry, and fill in IndexInfo for the new index with that. This makes the process more consistent with DefineIndex(), and the code is refactored with the addition of a routine to create an IndexInfo node. Reported-by: Manuel Rigger Author: Michael Paquier Discussion: https://postgr.es/m/CA+u7OA5Hp0ra235F3czPom_FyAd-3+XwSJmX95r1+sRPOJc9VQ@mail.gmail.com Backpatch-through: 12 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/7cce159349ccdb39ade07f869f08e4929ef2fe0b Modified Files -------------- src/backend/catalog/index.c | 74 +++++++++++++++++++++++++++--- src/backend/commands/indexcmds.c | 46 ++++++------------- src/backend/nodes/makefuncs.c | 52 ++++++++++++++++++++- src/include/nodes/makefuncs.h | 7 ++- src/test/regress/expected/create_index.out | 72 +++++++++++++++++++++++++++++ src/test/regress/sql/create_index.sql | 28 +++++++++++ 6 files changed, 237 insertions(+), 42 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
* pgsql: Fix handling of expressions and predicates in REINDEX CONCURRENT @ 2019-07-29 01:08 Michael Paquier <michael@paquier.xyz> 0 siblings, 0 replies; 2+ messages in thread From: Michael Paquier @ 2019-07-29 01:08 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix handling of expressions and predicates in REINDEX CONCURRENTLY When copying the definition of an index rebuilt concurrently for the new entry, the index information was taken directly from the old index using the relation cache. In this case, predicates and expressions have some post-processing to prepare things for the planner, which loses some information including the collations added in any of them. This inconsistency can cause issues when attempting for example a table rewrite, and makes the new indexes rebuilt concurrently inconsistent with the old entries. In order to fix the problem, fetch expressions and predicates directly from the catalog of the old entry, and fill in IndexInfo for the new index with that. This makes the process more consistent with DefineIndex(), and the code is refactored with the addition of a routine to create an IndexInfo node. Reported-by: Manuel Rigger Author: Michael Paquier Discussion: https://postgr.es/m/CA+u7OA5Hp0ra235F3czPom_FyAd-3+XwSJmX95r1+sRPOJc9VQ@mail.gmail.com Backpatch-through: 12 Branch ------ REL_12_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/28bbf7a81b3a30504cc7dfdbd76b410d1f127b8e Modified Files -------------- src/backend/catalog/index.c | 74 +++++++++++++++++++++++++++--- src/backend/commands/indexcmds.c | 46 ++++++------------- src/backend/nodes/makefuncs.c | 52 ++++++++++++++++++++- src/include/nodes/makefuncs.h | 7 ++- src/test/regress/expected/create_index.out | 72 +++++++++++++++++++++++++++++ src/test/regress/sql/create_index.sql | 28 +++++++++++ 6 files changed, 237 insertions(+), 42 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2019-07-29 01:08 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2019-07-29 01:08 pgsql: Fix handling of expressions and predicates in REINDEX CONCURRENT Michael Paquier <michael@paquier.xyz> 2019-07-29 01:08 pgsql: Fix handling of expressions and predicates in REINDEX CONCURRENT 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