Search For A Specific String In All Tables With PostgreSQL
I recently needed to find all instances of a string in every table of a database with PostgreSQL. This is a simple process of how I did this.
- Dump a temporary copy of the database:
su - pgsql
pg_dump --data-only --inserts exampledb > exampledb.psql
- Then grep through the dumped database file looking for the string "someString"
grep someString exampledb.psql