(executor)
| 96 | |
| 97 | @dbtest |
| 98 | def test_schemata_table_views_and_columns_query(executor): |
| 99 | run(executor, "create table a(x text, y text)") |
| 100 | run(executor, "create table b(z text)") |
| 101 | run(executor, "create view d as select 1 as e") |
| 102 | run(executor, "create schema schema1") |
| 103 | run(executor, "create table schema1.c (w text DEFAULT 'meow')") |
| 104 | run(executor, "create schema schema2") |
| 105 | |
| 106 | # schemata |
| 107 | # don't enforce all members of the schemas since they may include postgres |
| 108 | # temporary schemas |
| 109 | assert set(executor.schemata()) >= { |
| 110 | "public", |
| 111 | "pg_catalog", |
| 112 | "information_schema", |
| 113 | "schema1", |
| 114 | "schema2", |
| 115 | } |
| 116 | assert executor.search_path() == ["pg_catalog", "public"] |
| 117 | |
| 118 | # tables |
| 119 | assert set(executor.tables()) >= { |
| 120 | ("public", "a"), |
| 121 | ("public", "b"), |
| 122 | ("schema1", "c"), |
| 123 | } |
| 124 | |
| 125 | assert set(executor.table_columns()) >= { |
| 126 | ("public", "a", "x", "text", False, None), |
| 127 | ("public", "a", "y", "text", False, None), |
| 128 | ("public", "b", "z", "text", False, None), |
| 129 | ("schema1", "c", "w", "text", True, "'meow'::text"), |
| 130 | } |
| 131 | |
| 132 | # views |
| 133 | assert set(executor.views()) >= {("public", "d")} |
| 134 | |
| 135 | assert set(executor.view_columns()) >= {("public", "d", "e", "integer", False, None)} |
| 136 | |
| 137 | |
| 138 | @dbtest |
nothing calls this directly
no test coverage detected