fix(db_engine_specs): stop filtering out Postgres schemas prefixed with pg (#42312)

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Evan Rusackas
2026-07-31 10:58:59 -07:00
committed by GitHub
parent e391691328
commit dc632a9737
2 changed files with 56 additions and 0 deletions

View File

@@ -450,3 +450,33 @@ def test_interval_type_mutator() -> None:
assert mutator(True) is None
assert mutator([1, 2, 3]) is None
assert mutator({"days": 1}) is None
def test_get_schema_names_excludes_only_actual_system_schemas(
mocker: MockerFixture,
) -> None:
"""
DB Eng Specs (postgres): Test ``get_schema_names``
User-defined schemas that merely start with ``pg`` (but are not
actual Postgres system schemas, which always start with the literal
``pg_``) must not be filtered out. See issue #30678.
"""
inspector = mocker.MagicMock()
inspector.engine.connect().__enter__().execute.return_value = [
("public",),
("pgsql",),
("pgstats",),
("pg_catalog",),
("pg_toast",),
("information_schema",),
]
schemas = spec.get_schema_names(inspector)
assert schemas == {
"public",
"pgsql",
"pgstats",
"information_schema",
}