Due to the core design of this extension, you cannot use
pg_dump with a masked
user. If you want to export the entire database with the anonymized data, you
must use the
A user named
bob can export an anonymous dump of the
app database like
pg_dump_anon -h localhost -U bob --password --file=anonymous_dump.sql app
WARNING: The name of the database must be the last parameter.
For more details about the supported options, simply type
go install gitlab.com/dalibo/postgresql_anonymizer/pg_dump_anon
If you do not want to instal Go on your production servers, you can fetch the binary with:
docker run --rm -v "$PWD":/go/bin golang go get gitlab.com/dalibo/postgresql_anonymizer/pg_dump_anon sudo install pg_dump_anon $(pg_config --bindir)
The user password is asked automatically. This means you must either add the
--passwordoption to define it interactively or declare it in the PGPASSWORD variable or put it inside the .pgpass file ( however on Windows,the PGPASSFILE variable must be specified explicitly)
plainformat is the only supported format. The other formats (
tar) are not supported
Before version 1.0,
pg_dump_anon was a bash script. This script was nice and
simple, however under certain conditions the backup were not consistent. See
issue #266 for more details.
This script is now renamed to
pg_dump_anon.sh and it is still available for
backwards compatibility. But it will be deprecated in version 2.0.