BUG #15185: pg_dump doesn't include statistics when specifying a table

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: postgresql(at)lightn(dot)org
Subject: BUG #15185: pg_dump doesn't include statistics when specifying a table
Date: 2018-05-03 15:09:42
Message-ID: 152536018283.23581.1186978081424966318@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 15185
Logged by: Josha Foust
Email address: postgresql(at)lightn(dot)org
PostgreSQL version: 10.3
Operating system: Windows
Description:

After using the CREATE STATISTICS command to create multi-column statistics
on a table, calling pg_dump with the -t option doesn't include that
definition, but it does include things like indexes.

I see this note in the documentation: "When -t is specified, pg_dump makes
no attempt to dump any other database objects that the selected table(s)
might depend upon. Therefore, there is no guarantee that the results of a
specific-table dump can be successfully restored by themselves into a clean
database." I don't think that applies here, but please tell me if I'm
wrong.

Here is a simple test case, created in a database named "test":

create table Events (
EventDt timestamp(6) with time zone not null,
EventId integer not null,
ProjectId smallint not null,
LoggerId integer,
Message text
);
create index IX_Events_ProjectId_LoggerId on Events (ProjectId, LoggerId);
create statistics Events_ProjectLogger (dependencies) ON ProjectId, LoggerId
FROM Events;

pg_dump.exe -U postgres --schema-only test
pg_dump.exe -U postgres -t public.events --schema-only test

The first pg_dump command output shows the "CREATE STATISTICS" line, while
the second one does not. It seems like it should.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2018-05-03 15:17:43 Re: BUG #15185: pg_dump doesn't include statistics when specifying a table
Previous Message Greg Clough 2018-05-03 13:51:04 RE: postgresql license question