Files
supabase/apps/docs/content/guides/database/postgres/dropping-all-tables-in-schema.mdx
Taryn King 65c6929414 chore(docs): update docs to use postgres over postgresql language (#44881)
## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.

YES

## What kind of change does this PR introduce?

Updates verbiage throughout docs to use postgres over postgresql.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Documentation**
* Updated terminology throughout documentation, guides, and resources
for consistent product naming across all user-facing materials,
including page titles, descriptions, and reference documentation.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-04-15 09:49:45 +00:00

29 lines
1.1 KiB
Plaintext

---
title: 'Drop all tables in a Postgres schema'
description: 'Useful snippet for deleting all tables in a given schema'
footerHelpType: 'postgres'
---
Execute the following query to drop all tables in a given schema.
Replace `my-schema-name` with the name of your schema. In Supabase, the default schema is `public`.
<Admonition type="caution">
This deletes all tables and their associated data. Ensure you have a recent [backup](/docs/guides/platform/backups) before proceeding.
</Admonition>
```sql
do $$ declare
r record;
begin
for r in (select tablename from pg_tables where schemaname = 'my-schema-name') loop
execute 'drop table if exists ' || quote_ident(r.tablename) || ' cascade';
end loop;
end $$;
```
This query works by listing out all the tables in the given schema and then executing a `drop table` for each (hence the `for... loop`).
You can run this query using the [SQL Editor](/dashboard/project/_/sql) in the Supabase Dashboard, or via `psql` if you're [connecting directly to the database](/docs/guides/database/connecting-to-postgres#direct-connections).