From d6d322de980b920134cae437b91ea5a4f799afdf Mon Sep 17 00:00:00 2001 From: Mytherin Date: Tue, 4 Feb 2025 14:22:06 +0100 Subject: [PATCH] Fix #121: pass schema into CreateViewInfo::FromCreateView (requires upstream DuckDB fixes) --- src/storage/sqlite_transaction.cpp | 2 +- test/sql/storage/attach_describe.test | 6 ++++++ test/sql/storage/attach_show_tables.test | 11 +++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 test/sql/storage/attach_show_tables.test diff --git a/src/storage/sqlite_transaction.cpp b/src/storage/sqlite_transaction.cpp index 30f9b80..30d4639 100644 --- a/src/storage/sqlite_transaction.cpp +++ b/src/storage/sqlite_transaction.cpp @@ -74,7 +74,7 @@ optional_ptr SQLiteTransaction::GetCatalogEntry(const string &entr string sql; db->GetViewInfo(entry_name, sql); - auto view_info = CreateViewInfo::FromCreateView(*context.lock(), sql); + auto view_info = CreateViewInfo::FromCreateView(*context.lock(), sqlite_catalog.GetMainSchema(), sql); view_info->internal = false; result = make_uniq(sqlite_catalog, sqlite_catalog.GetMainSchema(), *view_info); break; diff --git a/test/sql/storage/attach_describe.test b/test/sql/storage/attach_describe.test index b92ebd6..0726a9e 100644 --- a/test/sql/storage/attach_describe.test +++ b/test/sql/storage/attach_describe.test @@ -16,6 +16,12 @@ DESCRIBE s1.test i BIGINT YES PRI NULL NULL j BIGINT YES NULL 42 NULL +query IIIIII +DESCRIBE TABLE s1.test +---- +i BIGINT YES PRI NULL NULL +j BIGINT YES NULL 42 NULL + query ITTTTT PRAGMA table_info('s1.test'); ---- diff --git a/test/sql/storage/attach_show_tables.test b/test/sql/storage/attach_show_tables.test new file mode 100644 index 0000000..7d78dd6 --- /dev/null +++ b/test/sql/storage/attach_show_tables.test @@ -0,0 +1,11 @@ +# name: test/sql/storage/attach_show_tables.test +# description: +# group: [sqlite_storage] + +require sqlite_scanner + +statement ok +ATTACH 'data/db/sakila.db' AS sakila (TYPE SQLITE, READ_ONLY) + +statement ok +SHOW TABLES