Skip to content

Commit

Permalink
Fix #104: make CREATE OR REPLACE TABLE work in SQLite catalog instead…
Browse files Browse the repository at this point in the history
… of throwing an exception
  • Loading branch information
Mytherin committed Sep 4, 2024
1 parent d4a7917 commit 9227865
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/storage/sqlite_schema_entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
21 changes: 21 additions & 0 deletions test/sql/storage/attach_create_or_replace.test
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 9227865

Please sign in to comment.