Skip to content

Commit

Permalink
fix: Remove incorrect temp table check during resolve (#2783)
Browse files Browse the repository at this point in the history
  • Loading branch information
scsmithr authored Mar 14, 2024
1 parent 61dd77c commit fab455e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 deletions.
3 changes: 0 additions & 3 deletions crates/sqlexec/src/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
23 changes: 12 additions & 11 deletions testdata/sqllogictests/temp_table.slt
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ select * from t1;

# Dropping temp tables

statement error
statement error
drop table t1, t2;

# t1 shouldn't be dropped
Expand All @@ -110,9 +110,6 @@ select * from t1
3
5

# Need to determine if below behavior is correct.
halt

statement ok
drop table t1, abc;

Expand All @@ -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
Expand Down Expand Up @@ -159,4 +150,14 @@ select * from tmp1;
query I
select count(*) from glare_catalog.tables where table_name = 'tmp1';
----
0
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;

0 comments on commit fab455e

Please sign in to comment.