Today I successfully upgraded postgres from 11 to 12 using the
pg_upgrade method. It went flawelessly, thanks!
I noticed that pg_dumpall and initdb like to examine the current
working directory, for example with current working directory /root:
# su _postgresql -c "pg_dumpall -U postgres > /var/postgresql/full.sqldump"
could not identify current directory: Permission denied
Password for user postgres:
could not identify current directory: Permission denied
psql: fatal: could not find own program executable
We already have c&p commands that cd /var/postgresql, this adds it for
the remaining ones where it seems important.
OK?
diff --git Makefile Makefile
index 8cd12215710..11b9abe7daf 100644
--- Makefile
+++ Makefile
@@ -16,7 +16,7 @@ PKGNAME-docs= postgresql-docs-${VERSION}
PKGNAME-contrib=postgresql-contrib-${VERSION}
PKGNAME-plpython=postgresql-plpython-${VERSION}
PKGNAME-pg_upgrade=postgresql-pg_upgrade-${VERSION}
-
+REVISION-main= 0
CATEGORIES= databases
SHARED_LIBS= ecpg 7.10 \
diff --git pkg/README-server pkg/README-server
index 7fa6fef048a..92ef8c3f149 100644
--- pkg/README-server
+++ pkg/README-server
@@ -107,7 +107,8 @@ This will work for any upgrade from any major version of
PostgreSQL
to the current version.
1) Backup all your data:
-# su _postgresql -c "pg_dumpall -U postgres > /var/postgresql/full.sqldump"
+# su _postgresql -c "cd /var/postgresql && \
+ pg_dumpall -U postgres > /var/postgresql/full.sqldump"
2) Shutdown the server:
# rcctl stop postgresql
@@ -120,8 +121,8 @@ to the current version.
5) Create a new data directory:
# su _postgresql -c "mkdir /var/postgresql/data"
-# su _postgresql -c \
- "initdb -D /var/postgresql/data -U postgres -A scram-sha-256 -E UTF8 -W"
+# su _postgresql -c "cd /var/postgresql && \
+ initdb -D /var/postgresql/data -U postgres -A scram-sha-256 -E UTF8 -W"
6) Restore your old pg_hba.conf and (if used) SSL certificates
# su _postgresql -c \
@@ -136,7 +137,8 @@ Examine your old file for local changes and apply them to
the new version.
# rcctl start postgresql
8) Restore your data:
-# su _postgresql -c "psql -U postgres < /var/postgresql/full.sqldump"
+# su _postgresql -c "cd /var/postgresql && \
+ psql -U postgres < /var/postgresql/full.sqldump"
Option 2: pg_upgrade
--------------------
@@ -155,7 +157,7 @@ faster than a dump and reload, especially for large
databases.
# mv /var/postgresql/data /var/postgresql/data-${PREV_MAJOR}
4) Create a new data directory:
-# su _postgresql -c "mkdir /var/postgresql/data; \
+# su _postgresql -c "mkdir /var/postgresql/data && cd /var/postgresql && \
initdb -D /var/postgresql/data -U postgres -A scram-sha-256 -E UTF8 -W"
(The database environment defaults to UTF-8 if your terminal is already
--
I'm not entirely sure you are real.