Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision | |||
|
database:postgres [2025/09/02 15:11] admin |
database:postgres [2025/10/22 08:21] (current) admin |
||
|---|---|---|---|
| Line 3: | Line 3: | ||
| < | < | ||
| drop database [db] WITH (force) | drop database [db] WITH (force) | ||
| + | </ | ||
| + | |||
| + | |||
| + | ==== Drop all tables ==== | ||
| + | < | ||
| + | DO $$ | ||
| + | DECLARE | ||
| + | r RECORD; | ||
| + | BEGIN | ||
| + | FOR r IN (SELECT tablename FROM pg_tables WHERE schemaname = ' | ||
| + | EXECUTE 'DROP TABLE IF EXISTS ' || quote_ident(r.tablename) || ' CASCADE'; | ||
| + | END LOOP; | ||
| + | END $$; | ||
| </ | </ | ||