diff --git a/src/pgduckdb_metadata_cache.cpp b/src/pgduckdb_metadata_cache.cpp index 43edc4eb..8031cdf4 100644 --- a/src/pgduckdb_metadata_cache.cpp +++ b/src/pgduckdb_metadata_cache.cpp @@ -62,7 +62,10 @@ InvalidateCaches(Datum arg, int cache_id, uint32 hash_value) { return; } cache.valid = false; - list_free(cache.duckdb_only_functions); + if (cache.installed) { + list_free(cache.duckdb_only_functions); + cache.duckdb_only_functions = NIL; + } } /* diff --git a/test/regression/expected/basic.out b/test/regression/expected/basic.out index 3bfa1c1a..fc407602 100644 --- a/test/regression/expected/basic.out +++ b/test/regression/expected/basic.out @@ -43,3 +43,7 @@ SET duckdb.max_threads_per_query TO default; SET client_min_messages TO default; DROP TABLE t; DROP TABLE empty; +-- Check that DROP / CREATE extension works +DROP EXTENSION pg_duckdb; +CREATE EXTENSION pg_duckdb; +WARNING: To actually execute queries using DuckDB you need to run "SET duckdb.execution TO true;" diff --git a/test/regression/sql/basic.sql b/test/regression/sql/basic.sql index e8709e32..d32d3f0a 100644 --- a/test/regression/sql/basic.sql +++ b/test/regression/sql/basic.sql @@ -20,3 +20,8 @@ SET client_min_messages TO default; DROP TABLE t; DROP TABLE empty; + +-- Check that DROP / CREATE extension works + +DROP EXTENSION pg_duckdb; +CREATE EXTENSION pg_duckdb;