wal2json is an output plugin for logical decoding. It means that the plugin have
access to tuples produced by INSERT and UPDATE. Also, UPDATE/DELETE old row
versions can be accessed depending on the configured replica identity.
Changes can be consumed using the streaming protocol (logical replication slots)
or by a special SQL API.
You need to set up at least two parameters in postgresql.conf:
wal_level = logical
#
# these parameters only need to set in versions 9.4, 9.5 and 9.6
# default values are ok in version 10 or later
#
max_replication_slots = 10
max_wal_senders = 10
After changing these parameters, a restart is needed.
Affects: users of databases/postgresql* and other software using PostgreSQL to run
Author: kbowling@FreeBSD.org
Reason:
The default version of PostgreSQL has been switched from 17 to 18.
The upgrade procedure can use up twice the space the databases
currently needs. If you have a big amount of stored data take a
closer look at the manpage of pg_upgrade for avoidance and/or
speedup of the upgrade.
The upgrade instructions consider a basic usage and do not match
complex scenarios like replication, sharding, or similar.
Upgrade instructions:
First stop your PostgreSQL, create PostgreSQL-binaries and backup your data.
If you have another Version of PostgreSQL installed, for example 17, your
files are named according to this.
# service postgresql stop
# pkg create postgresql17-server postgresql17-contrib
# mkdir /tmp/pg-upgrade
# tar xf postgresql17-server-17.9.pkg -C /tmp/pg-upgrade
# tar xf postgresql17-contrib-17.9.pkg -C /tmp/pg-upgrade
# pkg delete -f databases/postgresql17-server databases/postgresql17-contrib databases/postgresql17-client
Now update PostgreSQL:
pkg user:
# pkg install databases/postgresql18-server databases/postgresql18-contrib
# pkg upgrade
Portmaster users:
# portmaster databases/postgresql18-server databases/postgresql18-contrib
# portmaster -a
Portupgrade users:
# portinstall databases/postgresql18-server databases/postgresql18-contrib
# portupgrade -a
After installing the new PostgreSQL version you need to convert
all your databases to new version:
# su -l postgres -c "/usr/local/bin/initdb --encoding=utf-8 --lc-collate=C --no-data-checksums -D /var/db/postgres/data18 -U postgres"
# su -l postgres -c "pg_upgrade -b /tmp/pg-upgrade/usr/local/bin/ -d /var/db/postgres/data17/ -B /usr/local/bin/ -D /var/db/postgres/data18/ -U postgres "
Now the migration is finished. You can start PostgreSQL again with:
# service postgresql start
ATTENTION:
1) If you use non-default initdb options, you have to adjust the initdb-command accordingly
2) The initdb in the upgrade procedure uses '--no-data-checksums' to enable
pg_upgrade from before this change. You should review the documentation and
decide whether you want to then enable checksums with pg_checksums. Future
upgrade instructions for PostgreSQL 19 and later will assume a default
initdb, and therefore that checksums are enabled.
Affects: users of databases/postgresql* and other software using PostgreSQL to run
Author: kbowling@FreeBSD.org
Reason:
The default version of PostgreSQL has been switched from 16 to 17.
The upgrade procedure can use up twice the space the databases
currently needs. If you have a big amount of stored data take a
closer look at the manpage of pg_upgrade for avoidance and/or
speedup of the upgrade.
The upgrade instructions consider a basic usage and do not match
complex scenarios like replication, sharding, or similar.
Upgrade instructions:
First stop your PostgreSQL, create PostgreSQL-binaries and backup your data.
If you have another Version of PostgreSQL installed, for example 16, your
files are named according to this.
# service postgresql stop
# pkg create postgresql16-server postgresql16-contrib
# mkdir /tmp/pg-upgrade
# tar xf postgresql16-server-16.8.pkg -C /tmp/pg-upgrade
# tar xf postgresql16-contrib-16.8.pkg -C /tmp/pg-upgrade
# pkg delete -f databases/postgresql16-server databases/postgresql16-contrib databases/postgresql16-client
Now update PostgreSQL:
pkg user:
# pkg install databases/postgresql17-server databases/postgresql17-contrib
# pkg upgrade
Portmaster users:
# portmaster databases/postgresql17-server databases/postgresql17-contrib
# portmaster -a
Portupgrade users:
# portinstall databases/postgresql17-server databases/postgresql17-contrib
# portupgrade -a
After installing the new PostgreSQL version you need to convert
all your databases to new version:
# su -l postgres -c "/usr/local/bin/initdb --encoding=utf-8 --lc-collate=C -D /var/db/postgres/data17 -U postgres"
# su -l postgres -c "pg_upgrade -b /tmp/pg-upgrade/usr/local/bin/ -d /var/db/postgres/data16/ -B /usr/local/bin/ -D /var/db/postgres/data17/ -U postgres "
Now the migration is finished. You can start PostgreSQL again with:
# service postgresql start
ATTENTION:
1) If you use non-default initdb options, you have to adjust the initdb-command accordingly
2024-07-23
Affects: users of databases/postgresql* and other software using PostgreSQL to run
Author: kbowling@FreeBSD.org
Reason:
The default version of PostgreSQL has been switched from 15 to 16.
The upgrade procedure can use up twice the space the databases
currently needs. If you have a big amount of stored data take a
closer look at the manpage of pg_upgrade for avoidance and/or
speedup of the upgrade.
The upgrade instructions consider a basic usage and do not match
complex scenarios like replication, sharding, or similar.
Upgrade instructions:
First stop your PostgreSQL, create PostgreSQL-binaries and backup your data.
If you have another Version of PostgreSQL installed, for example 15, your
files are named according to this.
# service postgresql stop
# pkg create postgresql15-server postgresql15-contrib
# mkdir /tmp/pg-upgrade
# tar xf postgresql15-server-15.7.pkg -C /tmp/pg-upgrade
# tar xf postgresql15-contrib-15.7.pkg -C /tmp/pg-upgrade
# pkg delete -f databases/postgresql15-server databases/postgresql15-contrib databases/postgresql15-client
Now update PostgreSQL:
pkg user:
# pkg install databases/postgresql16-server databases/postgresql16-contrib
# pkg upgrade
Portmaster users:
# portmaster databases/postgresql16-server databases/postgresql16-contrib
# portmaster -a
Portupgrade users:
# portinstall databases/postgresql16-server databases/postgresql16-contrib
# portupgrade -a
After installing the new PostgreSQL version you need to convert
all your databases to new version:
# su -l postgres -c "/usr/local/bin/initdb --encoding=utf-8 --lc-collate=C -D /var/db/postgres/data16 -U postgres"
# su -l postgres -c "pg_upgrade -b /tmp/pg-upgrade/usr/local/bin/ -d /var/db/postgres/data15/ -B /usr/local/bin/ -D /var/db/postgres/data16/ -U postgres "
Now the migration is finished. You can start PostgreSQL again with:
# service postgresql start
ATTENTION:
1) If you use non-default initdb options, you have to adjust the initdb-command accordingly
2023-09-08
Affects: users of databases/postgresql* and other software using PostgreSQL to run
Author: kbowling@FreeBSD.org
Reason:
The default version of PostgreSQL has been switched from 13 to 15.
The upgrade procedure can use up twice the space the databases
currently needs. If you have a big amount of stored data take a
closer look at the manpage of pg_upgrade for avoidance and/or
speedup of the upgrade.
The upgrade instructions consider a basic usage and do not match
complex scenarios like replication, sharding, or similar.
Upgrade instructions:
First stop your PostgreSQL, create PostgreSQL-binaries and backup your data.
If you have another Version of PostgreSQL installed, for example 13, your
files are named according to this.
# service postgresql stop
# pkg create postgresql13-server postgresql13-contrib
# mkdir /tmp/pg-upgrade
# tar xf postgresql13-server-13.12.pkg -C /tmp/pg-upgrade
# tar xf postgresql13-contrib-13.12.pkg -C /tmp/pg-upgrade
# pkg delete -f databases/postgresql13-server databases/postgresql13-contrib databases/postgresql13-client
Now update PostgreSQL:
pkg user:
# pkg install databases/postgresql15-server databases/postgresql15-contrib
# pkg upgrade
Portmaster users:
# portmaster databases/postgresql15-server databases/postgresql15-contrib
# portmaster -a
Portupgrade users:
# portinstall databases/postgresql15-server databases/postgresql15-contrib
# portupgrade -a
After installing the new PostgreSQL version you need to convert
all your databases to new version:
# su -l postgres -c "/usr/local/bin/initdb --encoding=utf-8 --lc-collate=C -D /var/db/postgres/data15 -U postgres"
# su -l postgres -c "pg_upgrade -b /tmp/pg-upgrade/usr/local/bin/ -d /var/db/postgres/data13/ -B /usr/local/bin/ -D /var/db/postgres/data15/ -U postgres "
Now the migration is finished. You can start PostgreSQL again with:
# service postgresql start
ATTENTION:
1) The default user changed from "pgsql" to "postgres" in 11. The migration steps above now assume
the "postgres" database user and FreeBSD user.
2) If you use non-default initdb options, you have to adjust the initdb-command accordingly
2021-10-24
Affects: users of databases/postgresql* and other software using PostgreSQL to run
Author: kbowling@FreeBSD.org
Reason:
The default version of PostgreSQL has been switched from 12 to 13.
The upgrade procedure can use up twice the space the databases
currently needs. If you have a big amount of stored data take a
closer look at the manpage of pg_upgrade for avoidance and/or
speedup of the upgrade.
The upgrade instructions consider a basic usage and do not match
complex scenarios like replication, sharding, or similar.
Upgrade instructions:
First stop your PostgreSQL, create PostgreSQL-binaries and backup your data.
If you have another Version of PostgreSQL installed, for example 12.8, your
files are named according to this.
# service postgresql stop
# pkg create postgresql12-server postgresql12-contrib
# mkdir /tmp/pg-upgrade
# tar xf postgresql12-server-12.8.pkg -C /tmp/pg-upgrade
# tar xf postgresql12-contrib-12.8.pkg -C /tmp/pg-upgrade
# pkg delete -f databases/postgresql12-server databases/postgresql12-contrib databases/postgresql12-client
Now update PostgreSQL:
pkg user:
# pkg install databases/postgresql13-server databases/postgresql13-contrib
# pkg upgrade
Portmaster users:
# portmaster databases/postgresql13-server databases/postgresql13-contrib
# portmaster -a
Portupgrade users:
# portinstall databases/postgresql13-server databases/postgresql13-contrib
# portupgrade -a
After installing the new PostgreSQL version you need to convert
all your databases to new version:
# su -l postgres -c "/usr/local/bin/initdb --encoding=utf-8 --lc-collate=C -D /var/db/postgres/data13 -U postgres"
# su -l postgres -c "pg_upgrade -b /tmp/pg-upgrade/usr/local/bin/ -d /var/db/postgres/data12/ -B /usr/local/bin/ -D /var/db/postgres/data13/ -U postgres "
Now the migration is finished. You can start PostgreSQL again with:
# service postgresql start
ATTENTION:
1) The default user changed from "pgsql" to "postgres" in 11. The migration steps above now assume
the "postgres" database user and FreeBSD user.
2) If you use non-default initdb options, you have to adjust the initdb-command accordingly