Satish Sharma
Satish Sharma

Reputation: 3294

DROP All VIEWS postgres

I have a database with an old broken version of PostGIS installed in it. I would like to easily drop all views in the database (they're all from PostGIS). Is there a simple way to do this? Even simply extracting a list of views names would be acceptable as I could just make a large DROP VIEWS statement.? Thanks In Advance

Upvotes: 0

Views: 2105

Answers (1)

This should give you a set of view names in the public schema. Replace 'sandbox' with the name of your database.

select table_name
from information_schema.views
where table_catalog = 'sandbox'
  and table_schema = 'public'

Upvotes: 2

Related Questions