Commit 9c8ee01f authored by Benjamin Eberlei's avatar Benjamin Eberlei

[DBAL-244] Fix Schema bug

parent 66b30b20
...@@ -43,7 +43,7 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager ...@@ -43,7 +43,7 @@ class PostgreSqlSchemaManager extends AbstractSchemaManager
*/ */
public function getSchemaNames() public function getSchemaNames()
{ {
$rows = $this->_conn->fetchAll('SELECT schema_name FROM information_schema.schemata'); $rows = $this->_conn->fetchAll("SELECT nspname as schema_name FROM pg_namespace WHERE nspname !~ '^pg_.*' and nspname != 'information_schema'");
return array_map(function($v) { return $v['schema_name']; }, $rows); return array_map(function($v) { return $v['schema_name']; }, $rows);
} }
......
...@@ -13,8 +13,14 @@ class PostgreSqlSchemaManagerTest extends SchemaManagerFunctionalTestCase ...@@ -13,8 +13,14 @@ class PostgreSqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
public function tearDown() public function tearDown()
{ {
parent::tearDown(); parent::tearDown();
if (!$this->_conn) {
return;
}
$this->_conn->getConfiguration()->setFilterSchemaAssetsExpression(null); $this->_conn->getConfiguration()->setFilterSchemaAssetsExpression(null);
} }
/** /**
* @group DBAL-177 * @group DBAL-177
*/ */
...@@ -26,6 +32,18 @@ class PostgreSqlSchemaManagerTest extends SchemaManagerFunctionalTestCase ...@@ -26,6 +32,18 @@ class PostgreSqlSchemaManagerTest extends SchemaManagerFunctionalTestCase
$this->assertEquals(array($params['user'], 'public'), $paths); $this->assertEquals(array($params['user'], 'public'), $paths);
} }
/**
* @group DBAL-244
*/
public function testGetSchemaNames()
{
$names = $this->_sm->getSchemaNames();
$this->assertInternalType('array', $names);
$this->assertTrue(count($names) > 0);
$this->assertTrue(in_array('public', $names), "The public schema should be found.");
}
/** /**
* @group DBAL-21 * @group DBAL-21
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment