pepijnve commented on code in PR #25887:
URL: https://github.com/apache/datafusion/pull/25887#discussion_r4370309254


##########
datafusion/sql/src/statement.rs:
##########
@@ -1675,14 +1676,16 @@ impl<S: ContextProvider> SqlToRel<'_, S> {
 
     /// Generate a logical plan from a "SHOW TABLES" query
     fn show_tables_to_plan(&self) -> Result<LogicalPlan> {
-        if self.has_table("information_schema", "tables") {
-            let query = "SELECT * FROM information_schema.tables;";
-            let mut rewrite = DFParser::parse_sql(query)?;
-            assert_eq!(rewrite.len(), 1);
-            self.statement_to_plan(rewrite.pop_front().unwrap()) // length of 
rewrite is 1
-        } else {
-            plan_err!("SHOW TABLES is not supported unless information_schema 
is enabled")
-        }
+        let Some(tables_table_ref) = self.resolve_info_table("tables") else {
+            return plan_err!(
+                "SHOW TABLES is not supported unless information_schema is 
enabled"
+            );
+        };
+
+        let query = format!("SELECT * FROM {tables_table_ref};");

Review Comment:
   I've polished #26057 and I think it's now in good enough shape for review. 
Leaving it marked as draft for now since it builds on the work done here and 
GitHub can't do cross fork stacked PRs yet.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to