sequences and pg_upgrade - Mailing list pgsql-hackers

From Peter Eisentraut
Subject sequences and pg_upgrade
Date
Msg-id f6ed028e-ac25-e849-aec6-8d69416f0090@2ndquadrant.com
Whole thread Raw
Responses Re: sequences and pg_upgrade  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: sequences and pg_upgrade  (Bruce Momjian <bruce@momjian.us>)
Re: sequences and pg_upgrade  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
I was toying with a couple of ideas that would involve changing the
storage of sequences.  (Say, for the sake of discussion, removing the
problematic/useless sequence_name field.)  This would cause problems for
pg_upgrade, because pg_upgrade copies the "heap" storage of sequences
like it does for normal tables, and we have no facilities for effecting
any changes during that.

There was a previous discussion in the early days of pg_migrator, which
resulted in the current behavior:
https://www.postgresql.org/message-id/flat/20090713220112.GF7933%40klana.box

This also alluded to what I think was the last change in the sequence
storage format (10a3471bed7b57fb986a5be8afdee5f0dda419de) between
versions 8.3 and 8.4.  How did pg_upgrade handle that?

I think the other solution mentioned in that thread would also work:
Have pg_upgrade treat sequences more like system catalogs, whose format
changes between major releases, and transferred them via the
dump/restore route.  So instead of copying the disk files, issue a
setval call, and the sequence should be all set up.

Am I missing anything?

Attached is a rough patch set that would implement that.

--
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: 9.5.4: Segfault (signal 11) while running ALTER TABLE
Next
From: Tom Lane
Date:
Subject: Re: standalone backend PANICs during recovery