[PATCH] pg_dump: Do not dump statistics for excluded tables

From: Rian McGuire <rian(dot)mcguire(at)buildkite(dot)com>
To: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: [PATCH] pg_dump: Do not dump statistics for excluded tables
Date: 2023-12-27 04:44:09
Message-ID: 7075d3aa-3f05-44a5-b68f-47dc6a8a0550@buildkite.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,

I've attached a patch against master that addresses a small bug in pg_dump.

Previously, pg_dump would include CREATE STATISTICS statements for
tables that were excluded from the dump, causing reload to fail if any
excluded tables had extended statistics.

The patch skips the creation of the StatsExtInfo if the associated
table does not have the DUMP_COMPONENT_DEFINITION flag set. This is
similar to how getPublicationTables behaves if a table is excluded.

I've covered this with a regression test by altering one of the CREATE
STATISTICS examples to work with the existing 'exclude_test_table'
run. Without the fix, that causes the test to fail with:
# Failed test 'exclude_test_table: should not dump CREATE STATISTICS
extended_stats_no_options'
# at t/002_pg_dump.pl line 4934.

Regards,
Rian

Attachment Content-Type Size
v1-0001-pg_dump-Do-not-dump-statistics-for-excluded-tables.patch text/plain 4.6 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2023-12-27 05:07:23 Re: POC: GROUP BY optimization
Previous Message Andrei Lepikhov 2023-12-27 04:35:41 Re: POC: GROUP BY optimization