Skip to content

Commit

Permalink
Fix for pg_duckdb cache invalidation (#192)
Browse files Browse the repository at this point in the history
* List `duckdb_only_functions` will be cleaned only if cache is
considered installed (i.e. list should be populated at this point).
* Should fix #187
  • Loading branch information
mkaruza authored Sep 19, 2024
1 parent ce4cf42 commit d6278c3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/pgduckdb_metadata_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

/*
Expand Down
4 changes: 4 additions & 0 deletions test/regression/expected/basic.out
Original file line number Diff line number Diff line change
Expand Up @@ -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;"
5 changes: 5 additions & 0 deletions test/regression/sql/basic.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit d6278c3

Please sign in to comment.