LoginSignup
3
4

More than 5 years have passed since last update.

PostgreSQLで一部のテーブルをまとめて削除

Last updated at Posted at 2017-02-24

データをインポートするときに処理の失敗、中断でワークテーブルが沢山残ってしまっていたので、それらのみ消す必要がありました。

名前でまとめられる場合は以下をpsqlで実行して、出来たクエリをコピペで実行します。likeの後ろはテーブル名の絞り込み条件です

select 'DROP TABLE '||'"'||relname||'"'||';'
from pg_stat_user_tables
where relname like 'hoge%tmp%';
3
4
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
4