diff --git a/src/storage/sqlite_schema_entry.cpp b/src/storage/sqlite_schema_entry.cpp index d5ddf1d..72e2392 100644 --- a/src/storage/sqlite_schema_entry.cpp +++ b/src/storage/sqlite_schema_entry.cpp @@ -284,6 +284,9 @@ void SQLiteSchemaEntry::DropEntry(ClientContext &context, DropInfo &info) { } auto table = GetEntry(GetCatalogTransaction(context), info.type, info.name); if (!table) { + if (info.if_not_found == OnEntryNotFound::RETURN_NULL) { + return; + } throw InternalException("Failed to drop entry \"%s\" - could not find entry", info.name); } auto &transaction = SQLiteTransaction::Get(context, catalog); diff --git a/test/sql/storage/attach_create_or_replace.test b/test/sql/storage/attach_create_or_replace.test new file mode 100644 index 0000000..b4d8113 --- /dev/null +++ b/test/sql/storage/attach_create_or_replace.test @@ -0,0 +1,21 @@ +# name: test/sql/storage/attach_create_or_replace.test +# description: +# group: [sqlite_storage] + +require sqlite_scanner + +statement ok +ATTACH '__TEST_DIR__/attach_unnest.sqlite' AS tmp (TYPE SQLITE); + +statement ok +USE tmp; + +statement ok +CREATE OR REPLACE TABLE xs AS SELECT unnest(['foo', 'bar', 'baz']) AS x; + +query I +SELECT * FROM xs; +---- +foo +bar +baz