pgsql: Don't reset relhasindex for partitioned tables on ANALYZE

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Don't reset relhasindex for partitioned tables on ANALYZE
Date: 2021-07-01 16:58:47
Message-ID: E1lz01X-0002d3-0W@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Don't reset relhasindex for partitioned tables on ANALYZE

Commit 0e69f705cc1a introduced code to analyze partitioned table;
however, that code fails to preserve pg_class.relhasindex correctly.
Fix by observing whether any indexes exist rather than accidentally
falling through to assuming none do.

Backpatch to 14.

Author: Alexander Pyhalov <a(dot)pyhalov(at)postgrespro(dot)ru>
Reviewed-by: Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Reviewed-by: Zhihong Yu <zyu(at)yugabyte(dot)com>
Discussion: https://postgr.es/m/CALNJ-vS1R3Qoe5t4tbzxrkpBtzRbPq1dDcW4RmA_a+oqweF30w@mail.gmail.com

Branch
------
REL_14_STABLE

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

Modified Files
--------------
src/backend/commands/analyze.c | 32 +++++++++++++++++++++++---------
src/test/regress/expected/vacuum.out | 22 ++++++++++++++++++++++
src/test/regress/sql/vacuum.sql | 16 ++++++++++++++++
3 files changed, 61 insertions(+), 9 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2021-07-01 17:33:22 pgsql: Add --clobber-cache option to initdb, for CCA testing.
Previous Message Alvaro Herrera 2021-07-01 16:58:46 pgsql: Don't reset relhasindex for partitioned tables on ANALYZE