osipovartem opened a new issue, #15960:
URL: https://github.com/apache/datafusion/issues/15960

   ### Describe the bug
   
   According to [Postgres 
docs](https://www.postgresql.org/docs/current/infoschema-tables.html) 
information_schema.tables should contain all tables and views defined in the 
current database.
   
   At the moment we are adding all tables from all catalogs
   
   ```rust
   async fn make_tables(
           &self,
           builder: &mut InformationSchemaTablesBuilder,
       ) -> Result<(), DataFusionError> {
           .....
           for catalog_name in self.catalog_list.catalog_names() {
               let catalog = self.catalog_list.catalog(&catalog_name).unwrap();
   
               for schema_name in catalog.schema_names() {
                   if schema_name != INFORMATION_SCHEMA {
                       // schema name may not exist in the catalog, so we need 
to check
                       if let Some(schema) = catalog.schema(&schema_name) {
                           for table_name in schema.table_names() {
                               if let Some(table) = 
schema.table(&table_name).await? {
                                   builder.add_table(
                                       &catalog_name,
                                       &schema_name,
                                       &table_name,
                                       table.table_type(),
                                   );
                               }
                           }
                       }
                   }
               }
   ...
   ```
   
   because of this, when calling a specific 
**catalog.information_schema.tables**, we get a list of all tables from all 
catalogs
   There may be problems with access rights to other catalogs, as well as 
incorrect information about the list of tables in the current catalog
   
   ### To Reproduce
   
   Register several catalogs with schemas and tables and run the query
   ```sql
   SELECT * FROM catalog_name.information_schema.tables
   ```
   
   ### Expected behavior
   
   The list of tables only from the **current catalog**
   
   ### Additional context
   
   _No response_


-- 
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: github-unsubscr...@datafusion.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to