DROP EXTENSION fully removes the ClickHouse FDW extension and all its objects from the current PostgreSQL database.
Unload the extension when you migrate queries back to native tables, decommission ClickHouse, or tidy unused dependencies. This frees shared libraries and avoids confusion for new engineers.
Use DROP EXTENSION clickhouse_fdw;
to delete the extension. Add IF EXISTS
to avoid errors if it is already gone. Add CASCADE
to drop dependent foreign tables automatically.
Choose CASCADE
when you no longer need any foreign tables that rely on ClickHouse.Choose RESTRICT
(default) when you plan to migrate those tables first; the command will abort if dependencies exist.
1. Confirm the extension \dx clickhouse_fdw
.
2. Migrate or drop foreign tables: CREATE TABLE orders_pg AS TABLE orders_ch;
3. Remove servers and user mappings if needed.
4. Run DROP EXTENSION IF EXISTS clickhouse_fdw CASCADE;
5. Verify with \dx
.
Extensions are database-local. You must repeat the command in every database that loaded ClickHouse FDW.Dropping it in postgres does not remove it from analytics.
• Take a backup with pg_dump
.
• Migrate critical data.
• Check application code for remaining foreign table references.
• Drop user mappings and servers to keep the catalog clean.
✓ No production queries run against foreign tables.
✓ All data replicated or archived.
✓ You are connected to the correct database.
✓ Proper privileges (superuser or owner).
.
Yes. Only a superuser or the extension owner can run DROP EXTENSION. Granting TEMP rights is insufficient.
No. The command only removes PostgreSQL objects. Your ClickHouse cluster and data remain intact.
Absolutely. Run CREATE EXTENSION clickhouse_fdw; again after installing the shared library.