WombaT
WombaT

Reputation: 800

PostgreSQL search for a table name in views code

I have a postgresql database with a lot of schemas, tables and views. Recently, some 3 tables was replaced with one.

Now i have over 1000 views which may use these old tables. Checking them manually is little boring and easy to miss something. Is there any way to search for particular table, or better: schema in all existing views in database?

Upvotes: 2

Views: 3391

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1269753

You can do this through information_schema.views, which is documented here. Something like this:

select v.*
from information_schema.views v
where v.view_definition like '%tablename%';

Upvotes: 5

Related Questions