티스토리 뷰
select 'drop table if exists "' || tablename || '" cascade;' from pg_tables;
이렇게 해서 출력되는 명령문들 복사해서 입력해서 삭제하기
schema 날려버리는 방법보다 훨씬 안전하고 좋음
출처 :
https://stackoverflow.com/questions/3327312/how-can-i-drop-all-the-tables-in-a-postgresql-database
How can I drop all the tables in a PostgreSQL database?
How can I drop all tables in PostgreSQL, working from the command line? I don't want to drop the database itself, just all tables and all the data in them.
stackoverflow.com
'Database > PostgreSQL' 카테고리의 다른 글
[PostgreSQL] The data directory contains an old postmaster.pid file (0) | 2023.01.30 |
---|---|
Create Database (0) | 2022.08.17 |
Ubuntu 환경에 PostgreSQL 설치 (0) | 2022.08.17 |
댓글