Re: [PROPOSAL] Backup and recovery of pg_statistic

From: Dmitry Ivanov <d(dot)ivanov(at)postgrespro(dot)ru>
To: pgsql-hackers(at)postgresql(dot)org
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bruce Momjian <bruce(at)momjian(dot)us>
Subject: Re: [PROPOSAL] Backup and recovery of pg_statistic
Date: 2015-12-24 14:28:11
Message-ID: 2854795.ZMV5h4SJdO@abook
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

> There's still the problem that it won't work across a major version
> upgrade that makes any change whatsoever to the rowtype of pg_statistic.

I'm sorry if my previous explanation was poor, this time I am going to be

Suppose you want to upgrade from 9.4 to 9.6. In that case you would use the
pg_upgrade utility provided by the release 9.6, which means that it's the
pg_dump who would have to connect to the older instance and to prepare tuples
to be inserted to the pg_statistic of the newer instance. The pg_dump utility
would have to convert statistical data to the new format (for example, add
placeholders for new columns), so generated INSERT statements would be fine
provided that the pg_dump would be up-to-date.

The documentation states that we should always run the pg_upgrade binary of
the new server, not the old one [
pgupgrade.html, Usage, #9]. This means that the pg_upgrade will definitely use
a fresh version of pg_dump utility that is aware of all possible pitfalls.

Furthermore, each INSERT statement consists of textually-serialized columns of
pg_statistic. Columns of 'anyarray' type are deserialized using the 'array_in'
procedure which performs various sanity checks, including the element type
check. Thus it is not possible to insert an anyarray object which will cause
server death.

Dmitry Ivanov
Postgres Professional:
Russian Postgres Company

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2015-12-24 15:18:48 Re: Commit fest status for 2015-11
Previous Message Alexander Korotkov 2015-12-24 13:57:21 Re: WIP: Rework access method interface