diff --git a/crates/sqlexec/src/resolve.rs b/crates/sqlexec/src/resolve.rs index f4b25c99b..3db6b1327 100644 --- a/crates/sqlexec/src/resolve.rs +++ b/crates/sqlexec/src/resolve.rs @@ -108,9 +108,6 @@ impl<'a> EntryResolver<'a> { schema, table, } => { - if let Some(table) = self.catalog.get_temp_catalog().resolve_temp_table(table) { - return Ok(ResolvedEntry::Entry(CatalogEntry::Table(table))); - } // If catalog is anything but "default", we know we need to do // external resolution since we don't store info about // individual tables. diff --git a/testdata/sqllogictests/temp_table.slt b/testdata/sqllogictests/temp_table.slt index 96a0679fe..1b0f90981 100644 --- a/testdata/sqllogictests/temp_table.slt +++ b/testdata/sqllogictests/temp_table.slt @@ -99,7 +99,7 @@ select * from t1; # Dropping temp tables -statement error +statement error drop table t1, t2; # t1 shouldn't be dropped @@ -110,9 +110,6 @@ select * from t1 3 5 -# Need to determine if below behavior is correct. -halt - statement ok drop table t1, abc; @@ -124,12 +121,6 @@ select * from current_session.abc; statement error Unable to fetch table provider select * from t1; -# external abc should still exist -statement ok -select * from current_session.abc limit 1; - - - # Create -> Replace -> Drop statement ok @@ -159,4 +150,14 @@ select * from tmp1; query I select count(*) from glare_catalog.tables where table_name = 'tmp1'; ---- -0 \ No newline at end of file +0 + +# Ensure we don't accidentally resolve to a temp table when we shouldn't. There +# was a misplaced temp table check when provided a fully qualified reference +# which short-circuited actually hitting an external db. + +statement ok +create temp table my_temp as select * from generate_series(1, 5); + +statement error Unable to fetch table provider +select * from external_db.extenal_schema.my_temp;