1

I was recently updating my postgres from 9.5 to 9.6.2 (installed with home-brew, though the old binaries were downloaded from postgresql directly), and I encountered a strange problem. I have been following this guide, and everything went okay. I had to modify some commands as my encoding info was strange, but everything worked (modified commands listed below.)

initdb --local=C /usr/local/var/postgres -E utf8 --lc-ctype=en_US.UTF-8
pg_upgrade -d /usr/local/var/postgres96 -D /usr/local/var/postgres -b /Users/MyUser/Downloads/pgsql/bin/ -B /usr/local/Cellar/postgresql/9.6.2/bin/

Note: I moved the old data cluster to posgres96 before beginning the process.

However, none of the data transferred over. I ran du -sh /usr/local/var/*/, and all of my data is still in postgres96, but none transferred over to the new cluster.

4.0K    /usr/local/var/db/
 80K    /usr/local/var/homebrew/
 48K    /usr/local/var/log/
141M    /usr/local/var/postgres/
386M    /usr/local/var/postgres96/
  0B    /usr/local/var/run/

I re-ran everything, and noticed in the output of pg_upgrade there was a weird anomaly.

Performing Consistency Checks
-----------------------------
Checking cluster versions                                   ok
Checking database user is the install user                  ok
Checking database connection settings                       ok
Checking for prepared transactions                          ok
Checking for reg* system OID user data types                ok
Checking for contrib/isn with bigint-passing mismatch       ok
Checking for roles starting with 'pg_'                      ok
Creating dump of global objects                             ok
Creating dump of database schemas
                                                            ok
Checking for presence of required libraries                 ok
Checking database user is the install user                  ok
Checking for prepared transactions                          ok

If pg_upgrade fails after this point, you must re-initdb the
new cluster before continuing.

Performing Upgrade
------------------
Analyzing all rows in the new cluster                       ok
Freezing all rows on the new cluster                        ok
Deleting files from new pg_clog                             ok
Copying old pg_clog to new server                           ok
Setting next transaction ID and epoch for new cluster       ok
Deleting files from new pg_multixact/offsets                ok
Copying old pg_multixact/offsets to new server              ok
Deleting files from new pg_multixact/members                ok
Copying old pg_multixact/members to new server              ok
Setting next multixact ID and offset for new cluster        ok
Resetting WAL archives                                      ok
Setting frozenxid and minmxid counters in new cluster       ok
Restoring global objects in the new cluster                 ok
Restoring database schemas in the new cluster
                                                            ok
Copying user relation files
                                                            ok
Setting next OID for new cluster                            ok
Sync data directory to disk                                 ok
Creating script to analyze new cluster                      ok
Creating script to delete old cluster                       ok

Upgrade Complete

It seems like the database schemas never got dumped? Regardless, all of my data is trapped in postgres96, and I can't get it out. Any help or insight would be appreciated.

Edit: I ended up just reinstalling an older postgres and dumping my data into the new server (which worked). I'd still be interested to know why pg_upgrade wasn't working though.

4

0 回答 0