0

I want to search my entire Postgres database for a particular value. Once that particular value is found, return the row and table_name where it was found.

This question is similar, but does not have a sufficient answer.

I am open to any solution, using SQL or otherwise.

Community
  • 1
  • 1
Don P
  • 60,113
  • 114
  • 300
  • 432
  • Why don't you parse the dump? 1. Make db dump (http://www.postgresql.org/docs/9.1/static/backup-dump.html) 2. Parse it using your preferable script language or just open it as a text and make a search. – Bandydan Feb 23 '15 at 09:02
  • Some of these databases are a few GB or more. I'm worried that storing the dump somewhere and grep'ing will be extremely slow – Don P Feb 23 '15 at 19:28

1 Answers1

0

basically all you can do here is write a stored procedure. how can it work? you fetch a list of objects and relevant columns from pg_tables / pg_attribute and do the search one by one. this is the only. i don't consider it a good idea to do this kind of stuff at all but if it is necessary for some reason this is the way to go.