Thread: Drop table wildcard

Drop table wildcard

From
Danny Aldham
Date:
I am working with some software that creates a lot of temporary tables
to store query returns. So after a few weeks I have over 200 tables
named tmp_123_some_number_etc . Is there a way from psql for me to
drop all the tables with names beginning with tmp_ ?
Thanks

--
Danny Aldham     Providing Certified Internetworking Solutions to Business
www.postino.com  E-Mail, Web Servers, Web Databases, SQL PHP & Perl

Re: Drop table wildcard

From
Tom Lane
Date:
Danny Aldham <danny@lennon.postino.com> writes:
> I am working with some software that creates a lot of temporary tables
> to store query returns. So after a few weeks I have over 200 tables
> named tmp_123_some_number_etc . Is there a way from psql for me to
> drop all the tables with names beginning with tmp_ ?

Why don't you make it create the tables as TEMP tables to begin with?
Then they'll go away by themselves.

            regards, tom lane