I am writing a configuration entity modul in drupal 9. I want to list all tables, from an external database (postgis) in the schema called gi. The switch between the databases is no problem. I'm searching for a way, to only get the name of the table called gruenzuege to put this in a markup form.
//the form where to save the table
$form['tables'] = [
'#type' => 'fieldset',
'#title' => $this->t('Tables'),
'#collapsible' => TRUE, // Added
'#collapsed' => FALSE, // Added
];
//External Database connection
$postgis_database = array(
'database' => $drugis_postgis_connection->getdatabase(),
'username' => $drugis_postgis_connection->getusername(),
'password' => $drugis_postgis_connection->getpassword(),
'host' => $drugis_postgis_connection->gethost(),
'driver' => 'pgsql'
);
Database::addConnectionInfo('postgis', 'default', $postgis_database);
Database::setActiveConnection('default', 'postgis');
//example for fetching table:gruenzuege in drupal
$results = Database::getConnection('default', 'postgis')->query('SELECT * FROM "gi"."gruenzuege"')->fetchAll();
dpm($results);
I don't understand how to query to another schema, to get only, the table names of the schema gi? It is actually the only table. Thanks for help