[GENERAL] Run statements before pg_dump in same transaction?

Поиск
Список
Период
Сортировка
От François Beausoleil
Тема [GENERAL] Run statements before pg_dump in same transaction?
Дата
Msg-id 0B76357E-BD7C-4B40-82FA-19FE6F6CA7C5@teksol.info
обсуждение исходный текст
Ответы Re: [GENERAL] Run statements before pg_dump in same transaction?  (John R Pierce <pierce@hogranch.com>)
Re: [GENERAL] Run statements before pg_dump in same transaction?  (John R Pierce <pierce@hogranch.com>)
Re: [GENERAL] Run statements before pg_dump in same transaction?  (Adrian Klaver <adrian.klaver@aklaver.com>)
Re: Run statements before pg_dump in same transaction?  ("Greg Sabino Mullane" <greg@turnstep.com>)
Список pgsql-general
Hi all!

For development purposes, we dump the production database to local. It's fine because the DB is small enough. The
company'sgrowing and we want to reduce risks. To that end, we'd like to anonymize the data before it leaves the
databaseserver. 

One solution we thought of would be to run statements prior to pg_dump, but within the same transaction, something like
this:

BEGIN;
UPDATE users SET email = 'dev+' || id || '@example.com', password_hash = '/* hash of "password" */', ...;
-- launch pg_dump as usual, ensuring a ROLLBACK at the end
-- pg_dump must run with the *same* connection, obviously

-- if not already done by pg_dump
ROLLBACK;

Is there a ready-made solution for this? Our DB is hosted on Heroku, and we don't have 100% flexibility in how we dump.

I searched for "postgresql anonymize data dump before download"[1] and variations, but I didn't see anything highly
relevant.

Thanks!
François

PS: Cross-posted to http://dba.stackexchange.com/q/168023/3935

  [1]: https://duckduckgo.com/?q=postgresql+anonymize+data+dump+before+download



В списке pgsql-general по дате отправления:

Предыдущее
От: "Peter J. Holzer"
Дата:
Сообщение: Re: [GENERAL] Autoanalyze oddity
Следующее
От: John R Pierce
Дата:
Сообщение: Re: [GENERAL] Run statements before pg_dump in same transaction?